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

successfull 'when' does not skip the following tests. #217

Closed
p6rt opened this issue Aug 6, 2008 · 10 comments
Closed

successfull 'when' does not skip the following tests. #217

p6rt opened this issue Aug 6, 2008 · 10 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 6, 2008

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

Searchable as RT57652$

@p6rt
Copy link
Author

p6rt commented Aug 6, 2008

From perl6@yaakovnet.net

Yesterday, I downloaded and compiled perl6 of parrot-0.6.4.
Testing some basic perl6 features, I found this example​:

my xyz="spot";
given $xyz {
  when 'spot' { say 'is "spot"'; }
  when /spot/ { say 'contains "spot"'; }
  default { say 'unknown'; }
}

This should print 'is "spot"'.

But, in fact, it prints all three lines​:
is "spot"
contains "spot"
unknown

I hope that this can be fixed easily.

@p6rt
Copy link
Author

p6rt commented Sep 6, 2008

From @stifynsemons

In the attached code, there is a fairly simple example of a case statement
using given/when that has multiple clauses executed. I assumed from my
reading of S04 that if one of the when block is taken, when it finishes
control exits the innermost given block, though the English is confusing to
me. However it doesn't and continues on to both the when * clause and the
default clause.
Execution​:
sully​:perl6 stephensimmons$ adventure_world/a1b.p6
You are at (0, 0) within region outside.
n
Oops!;
What does n mean?
You are at (0, 1) within region outside.

@p6rt
Copy link
Author

p6rt commented Sep 6, 2008

From @stifynsemons

a1b.p6

@p6rt
Copy link
Author

p6rt commented Sep 6, 2008

From @stifynsemons

Okay, I noticed in src/parser/actions.pm, when_statement($/) a todo comment that seems
apropos to this bug report.

@p6rt
Copy link
Author

p6rt commented Sep 6, 2008

@stifynsemons - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 12, 2008

From @bacek

Hello.

There is patch for this (and not only this) issue.

1. Change logic in compilers/pct/src/PAST/Compiler.pir to handle
'control' attribute.
2. Implement "break" built-in in Rakudo.
3. Add "break" call to each "when" statements (in Rakudo)

--
Bacek

@p6rt
Copy link
Author

p6rt commented Oct 12, 2008

From @bacek

control_break.pir

@p6rt
Copy link
Author

p6rt commented Oct 12, 2008

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

@p6rt
Copy link
Author

p6rt commented Dec 16, 2008

From @moritz

On Wed Aug 06 04​:20​:19 2008, perl6@​yaakovnet.net wrote​:

Yesterday, I downloaded and compiled perl6 of parrot-0.6.4.
Testing some basic perl6 features, I found this example​:

my xyz="spot";
given $xyz {
when 'spot' { say 'is "spot"'; }
when /spot/ { say 'contains "spot"'; }
default { say 'unknown'; }
}

This should print 'is "spot"'.

But, in fact, it prints all three lines​:
is "spot"
contains "spot"
unknown

This has been fixed today (if you say 'my $xyz' at the start), thanks
for your report.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Dec 16, 2008

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

@p6rt p6rt closed this as completed Dec 16, 2008
@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