Skip to content
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

White space breaks feed syntax ==> with grep and map - bogus statement #3499

Closed
p6rt opened this issue Sep 1, 2014 · 5 comments
Closed

White space breaks feed syntax ==> with grep and map - bogus statement #3499

p6rt opened this issue Sep 1, 2014 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Sep 1, 2014

Migrated from rt.perl.org#122679 (status was 'rejected')

Searchable as RT122679$

@p6rt
Copy link
Author

p6rt commented Sep 1, 2014

From kevin@thecolyers.net

I was playing with Game​::Crypt 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 perl6 version 2014.08-6-gc793d80 built on MoarVM version
2014.08-36-g7938703
Ubuntu 14.04.1 LTS

Also breaks on

This is perl6 version 2014.08-185-g7e61510 built on MoarVM version
2014.08-55-ga5ae111

Very much enjoyed puzzling this one out!

Cheers,

Kevin

--
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.colyer@​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

@p6rt
Copy link
Author

p6rt commented Sep 8, 2014

From @masak

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.

@p6rt
Copy link
Author

p6rt commented Sep 8, 2014

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 8, 2014

@masak - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Sep 8, 2014
@p6rt
Copy link
Author

p6rt commented Sep 8, 2014

From kevin@thecolyers.net

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.colyer@​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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant