@showln in Base?

Hi,
I found the @tim.holy’s @showln macro pretty useful and I wonder if it should be included into Base ?

2 Likes

Can you provide some link to it or an example? I’m not aware of this macro or what it does. I do believe you that it is useful because that’s pretty much how he does things.

1 Like
1 Like

Cool macro.
I am going to start using that.

As a general guiding principle, if something can be done in a package, it should be done in a package rather that being in Base/StdLibs.
This is primarily because Base/StdLibs are second class packages.

You can’t update to use a newer StdLib with an older Julia version – which is a problem for people who want to use the Long Term Support (LTS) release.

You also can’t make breaking changes if you workout e.g. a better API, since that would be a breaking change to Julia itself.

An arguably exception to this general principle is if Base /stdlibs already does something badly/less precisely. Then maybe it should have the feature to do it well
Which could be the case for @showln , it’s kind of a better @show.
.

6 Likes

Good sales pitch. Start off with a “no”, work your way to a “yes”!

2 Likes

Which demonstrates an important point: it is frequently possible to improve on existing solutions. But once they are in the standard libraries, updating them becomes a slower and more difficult process.

A lot of things are useful, but they should not be in Base so that they can continue to be improved, or deprecated when better solutions emerge. using DebuggingUtilities is not that big of a hassle.

Thank you for your replies !

I though @showln might be suited for Base because I considered about a million time to write a similar macro and only discovered it exists recently.

Observing that some very experienced Julia developers

  1. express an interest for @showln,
  2. did not knew about it,

I conclude that there is an issue with the @showln's discoverability :wink:

2 Likes

Yes, but the answer to that is not putting things in Base, but making eg juliahub index the package. My understanding that having generated docs would achieve this.

1 Like

I understand the care that must be taken with Base or Stdlibs extensions.

Although I still think that the specific features of @showln which is :

  • very simple
  • of general and early interest

makes it a natural basic functionality.

2 Likes

Or for example writing a blog post.
“Ten useful tools I wish i knew about when starting to learn julia”
etc

1 Like

To make it easier to use, I’ve updated the package and submitted a registration request: https://github.com/JuliaRegistries/General/pull/21695
That should be enough to get it indexed by juliahub.
I’m not opposed to the idea of moving the new version of @showln into Base, though.

Differences from the previous v0.1 (unregistered) are mainly that @showln no longer uses indentation to indicated recursion depth (that’s now @showlnt), but in exchange it doesn’t cause the massive performance hit of @showlnt. Collecting a backtrace seemed like the only way to get callsite info back when DebuggingUtilities was first implemented, but we now have __source__ and that’s what the new @showln uses.

7 Likes