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
when() as a statement modifier outside a topicalizer both works and fails #10589
Comments
From @briandfoyCreated by @briandfoyPerl 5.12 allows when() as a statement modifier. I think this This script compiles just fine: use 5.012; Now, when I run this and respond to a prompt with a cat's name Buster That's fine, but I don't get the same error when I respond with Enter a cat name> Ella That is, the when() always works. If its condition is true, it also dies. If I verified this with all released versions of 5.12 and 5.13. I figure this should be a compile-time error, or, if we're really lazy, just Perl Info
|
From perl@profvince.com
$ perl -wE '$_ = "abc"; { when (/x/) { say "contains x" }; when $ perl -wE '$_ = "abc"; { say "contains x" when /x/; say "contains
$ perl -wE 'sub check { my $x = shift; say "contains $x" when /$x/ } $ perl -wE 'sub check { my $x = shift; when (/$x/) { say "contains Vincent. |
The RT System itself - Status changed from 'new' to 'open' |
From @briandfoyIn article <4C7B6AF4.7000207@profvince.com>, Vincent Pit
I don't see how your examples illustrate that, but I don't think that |
From perl@profvince.com
Although it is valid, I'll agree that it is kind of misleading of $ perl -wE 'sub check { say "fail" when /x/ } $_ = "xyz"; for $ perl -wE 'sub check { say "fail" when /x/ } $_ = "xyz"; given Vincent. |
From @cpansproutOn Sun Aug 29 22:29:58 2010, comdog wrote:
Clarifying the error message might help. If we make it clear that We currently have: Can't "when" outside a topicalizer But it should be more like: "when" can't break outside a topicalizer But ‘break outside’ could be misconstrued as ‘break out of’. Maybe: "when" can't break without a topicalizer (The archaistic could make the same argument about that one.) "when" can't find a topicalizer to exit -- Father Chrysostomos |
From @rjbs* Father Chrysostomos via RT <perlbug-followup@perl.org> [2012-08-19T15:07:16]
FWIW, I like this one. -- |
From zefram@fysh.orgIt's a deliberate design choice that topicalisers are dynamically scoped. -zefram |
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#77510 (status was 'rejected')
Searchable as RT77510$
The text was updated successfully, but these errors were encountered: