-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow nothing to be printed #32148
Allow nothing to be printed #32148
Conversation
This is the kind of thing that causes somebody with the username |
The 1 CI failure was a network blip. |
I guess this should be tagged with [Triage] |
Seriously though, I don't fully understand the argument for this. Why is it correct for a program that was trying to print something else to print the string |
It just breaks so much code, so often. But it breaks packages all the time when they forget to special case it. A particularly common place they forget to special case it is in error messages.
If I understood our previous discussions in #30757
If you've put it into a string, e.g. via string interolation, then you know you are passing a string into a command, (and not the result of some other command). To my mind that discussion and the expansion from |
Every generic function has to have a meaning, or else there is no way to tell which methods might make sense. But I'll put this aside and assume there is a better argument than just nihilism.
Here it's better to use
Yes, this is a case that seems to come up a bunch. The problem is that string interpolation (and |
I agree, but it doesn't always generalize, It also comes up in the
One option is that they should get into the habit of writting
But sometimes you don't want At the end of the day, |
I strongly believe that the existing error behaviour is much worse than printing something. The default behaviour for a new type is to As for printing the string "nothing", I believe either we should stick with the convention for singletons to print the name of the global singleton instance, if there is one (e.g., "missing"). Even the default "Nothing()" would be better than the current error state. |
¯\_(ツ)_/¯ Ok. |
…ressions ccuring in commands
fix missing bracket fix up whitespace Keep defining custom show for nothing add printing of nothing Let print of nothing fallback to show
Rebased. Assuming tests pass can this be merged? |
ref JuliaLang#32148 string(nothing) is allowed because print(nothing) is allowed
ref #32148 string(nothing) is allowed because print(nothing) is allowed
ref JuliaLang#32148 string(nothing) is allowed because print(nothing) is allowed
I don't have julia installed so I am just sketching this out.
What this should do:
nothing
to beprint
ed, and interpolated into stringsnothing
to be interpolated into commands.This PR partially undoes #27352.
Turns out that not being able to print
nothing
is just really annoying.