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
Nil vs Any confusion (trap) #1134
Comments
|
I think there may be some confusion about the behavior of Nil here. From the docs https://docs.perl6.org/type/Nil
grammar G { token TOP { a+ } };
my Nil $n = G.parse("zz");
say $n.WHAT;
my $result = G.parse("zz");
say $result.WHAT;prints |
|
It does return Nil, what you are seeing there is the effect of assigning |
|
Duh. I'm an idiot. Thanks, |
|
Do we have it explained somewhere in the docs? If yes, where? For example, maybe it deserves a section in traps? |
|
Though it's not specific to Grammar, it's just what happens when you assign I'd go with making sure this is documented clearly in the variables page and make sure that Nil is searchable with a clear explanation somewhere. |
|
I don't know where this could be documented, but I've seen this confusion a couple of times. Let's document it as a trap perhaps? (i.e. not understand what Any or Nil do) |
|
https://irclog.perlgeek.de/perl6/2017-10-30#i_15374966 |
|
Text about it can be found at https://docs.perl6.org/type/Nil#index-entry-Nil_assignment |
|
@briandfoy , would the text linked by @W4anD0eR96 be enough? |
Which should it be? Here's what it does now.
And the result:
The text was updated successfully, but these errors were encountered: