You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⬥ fn foo {|f~| put hi-there; f 42 }
⬥ foo bar
⮕ hi-there
Exception: bad value: command must be callable or string containing slash, but is bar
Traceback:
[tty 12], line 1:
fn foo {|f~| put hi-there; f 42 }
[tty 14], line 1:
foo bar
I think the error should happen earlier, i.e., when the function call results in assigning the string bar to the formal parameter f~. This for consistency with the prohibition on assigning non-functions to f~ using var or set, and because a function parameter named with a tilde at the end should clearly be expected to receive a function value.
Whether $nil is to be allowed or not, is orthogonal to this. But it should also be consistent with what happens with variables. See #1248.
Edited to conform to new function syntax.
The text was updated successfully, but these errors were encountered:
I think the error should happen earlier, i.e., when the function call results in assigning the string bar to the formal parameter f~.
It's not quite that simple. Consider that a path containing a slash is valid; e.g., foo /bin/echo. So the rule should really be whether the argument can be resolved to a, possibly external, command -- not whether it is simply a string.
Consider this:
I think the error should happen earlier, i.e., when the function call results in assigning the string
bar
to the formal parameterf~
. This for consistency with the prohibition on assigning non-functions tof~
usingvar
orset
, and because a function parameter named with a tilde at the end should clearly be expected to receive a function value.Whether $nil is to be allowed or not, is orthogonal to this. But it should also be consistent with what happens with variables. See #1248.
Edited to conform to new function syntax.
The text was updated successfully, but these errors were encountered: