-
Notifications
You must be signed in to change notification settings - Fork 293
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
error when binding variables #3908
Comments
The binding operator documentation has this example.
So, perhaps the variable binding example, in the Container Binding section, should have been written as follows?
|
I'll have to check. This is one of the cases where the REPL might behave in a slightly different way. Thanks anyway for the report. |
Okay, I compiled the following code from a .raku script without errors. Raku and rakudo are new to me, so I didn't realize that there might be different errors when compiling a .raku script vs. using the REPL. Especially, when the code appears so simple.
|
Any way, we should probably try and use code that works the same in the two places, or simply add a warning. Thanks for the report anyway. |
This is one of the problems with the REPL. Which is why I often write the entirety of my code on a single line, in an enclosing block > { my $a = 42; my $b := $a; $b++; say $a; }
43 Another such problem is that operators often don't work correctly either. > sub postfix:<!> (UInt \n) {[×] 1..n}; say 5!
120
> say 5!
===SORRY!=== Error while compiling:
Negation metaoperator not followed by valid infix
------> say 5!⏏<EOL>
expecting any of:
infix
infix stopper
> Every time you press enter it creates a new execution environment. The way it currently does it has its issues. |
Looking for a place to document the potential issue with the REPL (there isn't really a good one at the moment), I found a footnote here describing a similar problem: https://docs.raku.org/language/variables#fn-ref-1 I don't think every example that has trouble in the REPL needs a footnote; my recommendation is to add a single warning to the REPL docs. |
The Binding section of the Container documentation has the following example.
However, when I attempt to repeat this example in the rakudo REPL, I get the following error.
Who is right? The documentation or the compiler?
The text was updated successfully, but these errors were encountered: