-
-
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
Interpolation of nothing
should be an error
#27352
Comments
I see the idea, but I can't help feeling that's not the right place to handle this. Forcing users to handle explicitly the possibility that a value is I guess the motivation in the present case is that |
What is the actual utility of allowing |
I agree interpolation doesn't sound very useful nor legitimate. But |
Argument for the specialness of |
Another argument is that printing of
Now perhaps this could be argued that it's the responsibility of the CSV writer to handle this case, but it is somewhat compelling to me. It's also interesting that the REPL doesn't even attempt to print anything when the result is |
This is slightly off-topic, but |
Maybe CSV writers should print |
I think it makes sense for @test_throws ArgumentError "$(nothing)"
@test "$(missing)" == ""
@test join([1,2,missing,4], "") == "1,2,,4" |
This would imply that |
Yes, along with repr, which should also print “missing”.
|
Seems reasonable to me and worth trying. I like the "fatal absence" versus "non-fatal absence" distinction. |
Consider a new user trying out something like
You really want them to get an |
That case can have a very helpful, specific error message, which makes it not so frustrating since it immediately tells you how to fix the problem: do |
Quite right --- getting an error (hopefully with a useful message) while trying things out is not a problem at all compared to silently getting |
I guess with a good error message it wouldn't be so bad. |
See #27729 which proposes |
FWIW, I'm not opposed to |
Triage is in favor, noting that if we change our minds, we can but if we don't do this now, we can't change it in the 1.x timeline. |
Any resolution wrt. #27650? Can logging of |
I don't think logging should use |
Now that we're firming up our notion of what
nothing
andmissing
actually mean, we should probably semantically enforce them a little bit more. Example:Sys.which(cmd)
will returnnothing
if the givencmd
cannot be found on thePATH
. This makes it easy to define a hierarchy of commands:coalesce(Sys.which("curl"), Sys.which("wget"))
, etc... However, if the user then interpolates the result into aCmd
, it makes sense that we should error out.Jeff suggested disallowing all kinds of
print()
orstring()
conversion ofnothing
, leaving onlyrepr()
. I tend to agree, despite that this has the potential to be a quite breaking change.I would also like to suggest that
missing
get a similar treatment, as it is a subtly different but largely identical concept.The text was updated successfully, but these errors were encountered: