Kevin (>):
> I was playing with Game::Crypt
\o/
> and ran into the following problem.
> Compile crashes with a Bogus statement error. It seems that the
> insertion of a newline breaks the compile. I don't think this is perlsh
> behaviour!
>
> The following code reproduces it:
>
> use v6;
>
> sub foo($bar) {
>
> $bar
> ==> grep { / Cat / } ==> map { substr(1) } # compiles
> }
>
> sub baz($bar) {
>
> $bar
> ==> grep { / Cat / }
> ==> map { substr(1) } # does not compile
>
> }
This is "expected" behavior -- the '}' after '/ Cat /' ends the statement, by
S04's =head1 Statement-ending blocks.
I agree that many people will fall into this trap -- and that this is one of
the very few cases when the rule seems to work against users' expectations --
but inserting a special case that makes this an exception to the S04 rule would
set a bad precedent and break one-pass parsing. *Maaaybe* it'd be a good idea
to have a prefix:<< ==> >> detect this case and tell people what to do.
For people who do want that code layout, unspace at the end of the line (`grep
{ / Cat / } \`) makes it work, as the `}` is now no longer last on the line.
Rejecting ticket.