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

Rakudo allows 'when' block outside of a topicalizer block, shouldn't #1444

Closed
p6rt opened this issue Dec 16, 2009 · 6 comments
Closed

Rakudo allows 'when' block outside of a topicalizer block, shouldn't #1444

p6rt opened this issue Dec 16, 2009 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 16, 2009

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

Searchable as RT71368$

@p6rt
Copy link
Author

p6rt commented Dec 16, 2009

From @masak

<masak> std​: when 42 { say "This should fail" }
<p6eval> std 29347​: ok 00​:01 106m␤
<masak> ...because S04 says that a C<when> block outside of a
topicalizer block is a mortal sin.
<moritz_> at compile time?
<masak> aye.
<masak> it explicitly says that.
<moritz_> rakudo​: when 32 { say "ooops" }
<p6eval> rakudo 55f51d​: Use of uninitialized value␤
<masak> maybe I should submit a rakudobug, too? :)
<moritz_> sure
* masak submits

@p6rt
Copy link
Author

p6rt commented Sep 13, 2011

From @bbkr

NOM​: still broken

bbkr​:nom bbkr$ ./perl6 -e 'when 42 { say "This should fail" }'
Use of uninitialized value in numeric context

@p6rt
Copy link
Author

p6rt commented Sep 13, 2011

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

@p6rt
Copy link
Author

p6rt commented Nov 15, 2012

From @bbkr

2012.10 - still broken, but with different message

$ perl6 -e 'when 42 { say "This should fail" }'
use of uninitialized variable $a of type Any in numeric context in block at -e​:1

@p6rt
Copy link
Author

p6rt commented Jul 9, 2015

From @jnthn

On Wed Dec 16 08​:18​:11 2009, masak wrote​:

<masak> std​: when 42 { say "This should fail" }
<p6eval> std 29347​: ok 00​:01 106m␤
<masak> ...because S04 says that a C<when> block outside of a
topicalizer block is a mortal sin.
<moritz_> at compile time?
<masak> aye.
<masak> it explicitly says that.
<moritz_> rakudo​: when 32 { say "ooops" }
<p6eval> rakudo 55f51d​: Use of uninitialized value␤
<masak> maybe I should submit a rakudobug, too? :)
<moritz_> sure
* masak submits

Tried making this a mortal sin in a number of ways a month or two back. Actually discovered that there were loads of useful uses of when outside of a given/for-like construct that took advantage of every sub and block getting a fresh $_, setting it, and using when to check against it​:

sub foo(...) {
  ...
  $_ = something();
  when ... {
  }
  when ... {
  }
}

In discussion, nobody seemed to want to forbid this.

So, the design has been revised​:

Raku/old-design-docs@5f132abb41

Tests in S04-statements/when.t cover this behavior.

@p6rt
Copy link
Author

p6rt commented Jul 9, 2015

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

@p6rt p6rt closed this as completed Jul 9, 2015
@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