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
end-of-line curlies followed by operator on next line #5337
Comments
From @zoffixznetNot sure if something easy can be done to make this code work or at least improve the error message: say try { 42 } Right now it fails with: ===SORRY!=== Error while compiling /home/zoffix/CPANPRC/Terminal-Width/examples/term-width.p6 Avoiding the curlies or using unspace on the previous line makes it work. |
From @smlsThe fact that this fails to compile is not a bug, and has nothing to do with the `//` operator. If the closing curly brace of a block occurs as the last thing Some examples: for @foo { @foo.map: { try { custom-function { In other words, the rule makes sure that you don't have to worry about what counts as a special block statement, and what is merely a normal function/method call ending with a block. You can safely skip the semicolon for *all* of them.
Not gonna happen - or at least I'm pretty sure it won't. People have already suggested adding exceptions to the aforementioned rule for other cases where it gets in the way (e.g. in `==>` feed operator chains), but were always rejected by the powers that be.
I suppose it might be possible to make it so that if an invalid token is encountered in term position, the error handler checks if it immediately follows an end-of-line closing brace, and if so whether the token could match in operator position instead. This would allow it to offer a helpful suggestion in the error message. (I'm changing the title of the RT accordingly.) |
The RT System itself - Status changed from 'new' to 'open' |
@zoffixznet - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#128259 (status was 'rejected')
Searchable as RT128259$
The text was updated successfully, but these errors were encountered: