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

Statement level bare blocks for if statements #2199

Closed
p6rt opened this issue Sep 30, 2010 · 5 comments
Closed

Statement level bare blocks for if statements #2199

p6rt opened this issue Sep 30, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 30, 2010

Migrated from rt.perl.org#78142 (status was 'resolved')

Searchable as RT78142$

@p6rt
Copy link
Author

p6rt commented Sep 30, 2010

From @ashgti

The S04 section on Statement Level Bare Blocks says​:

# Not an error​: Equivalent to "if foo() -> $x { say $x }"
  { say $^x } if foo();

$ perl6

{ say $^x } if 1;
_block141

if 1 -> $x { say $x }
1

Seems like this is not functioning correctly. for loops seem to work fine​:

$ perl6

{ say $^x } for 1..3;
1
2
3
for 1..3 { say $^x };
1
2
3

So, this might be if statement specific.

--
John Harrison

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

From @coke

On Wed Sep 29 21​:14​:01 2010, ash_gti wrote​:

The S04 section on Statement Level Bare Blocks says​:

# Not an error​: Equivalent to "if foo() -> $x { say $x }"
{ say $^x } if foo();

$ perl6

{ say $^x } if 1;
_block141

if 1 -> $x { say $x }
1

This now gives no output rather than the anonymous block's internal
name​:
10​:31 < [Coke]> rakudo​: { say $^x } if 1;
10​:31 <+p6eval> rakudo 38165a​: ( no output )

This still works​:
10​:32 < [Coke]> rakudo​: if 1 -> $x { say $x }
10​:32 <+p6eval> rakudo 38165a​: OUTPUT«1␤»

Seems like this is not functioning correctly. for loops seem to work
fine​:

$ perl6

{ say $^x } for 1..3;
1
2
3
for 1..3 { say $^x };
1
2
3

So, this might be if statement specific.

--
John Harrison

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

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

@p6rt
Copy link
Author

p6rt commented Apr 28, 2015

From @jnthn

On Wed Sep 29 21​:14​:01 2010, ash_gti wrote​:

The S04 section on Statement Level Bare Blocks says​:

# Not an error​: Equivalent to "if foo() -> $x { say $x }"
{ say $^x } if foo();

$ perl6

{ say $^x } if 1;
_block141

if 1 -> $x { say $x }
1

Seems like this is not functioning correctly. for loops seem to work fine​:

$ perl6

{ say $^x } for 1..3;
1
2
3
for 1..3 { say $^x };
1
2
3

So, this might be if statement specific.

It's fixed now for if/unless/given, and added tests to cover all of them to the appropriate test files in S04-statement-modifiers.

@p6rt p6rt closed this as completed Apr 28, 2015
@p6rt
Copy link
Author

p6rt commented Apr 28, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant