Totally understand. I wonder if a helpful comment on the compiler error
in this case could help users? Would it be possible? Assuming the
compiler can understand the context...
Thanks,
Kevin
On 08/09/14 09:57, Carl Mäsak via RT wrote:
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.
--
KEVIN COLYER
* YWAM Reading Associate
* Fresh Expressions Representative for YWAM England
* Emmanuel Anglican Church, Woodley
Reading, UK
Tel: +44 (0) 7967 105 273
Home: +44 (0) 118 376 7471
skype: kevincolyerwork
(alt email: kevin.col...@freshexpressions.org.uk)
http://www.freshexpressions.org.uk
Changing church for a changing world
http://www.emmanuelwoodley.org.uk
http://www.ywamreading.com
http://www.thecolyers.net
http://www.ywamengland.org
http://www.ywamkb.net
The YWAM KnowledgeBase: for YWAMers
to find and help each other online
http://www.incarnationalgraffiti.com
YWAM blog provoking creativity, missional thinking,
dialogue and spirituality – engaging in an urban europe