Skip Menu |
Report information
Id: 110820
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Variable declaration inside statement_modifier for inside junction triggers bogus redeclaration error in Rakudo
Date: Wed, 15 Feb 2012 15:37:02 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 475b
<masak> nom: sub balanced { all((my $c += $_ eq "[" ?? 1 !! -1) < 0 for $^s.comb) && !$c }; .say when &balanced for (^(2 ** 6))».fmt("%06b")».trans("01" => "[]") <p6eval> nom bd5adb: OUTPUT«===SORRY!===␤Redeclaration of symbol $c␤at /tmp/f7OZkWSnoP:1␤» <masak> huh. <masak> nom: all(my $c for ()) <p6eval> nom bd5adb: OUTPUT«===SORRY!===␤Redeclaration of symbol $c␤at /tmp/XLWPyMzIwp:1␤» <masak> that's the shortest I can make it. * masak submits rakudobug
Download (untitled) / with headers
text/plain 221b
it's at least not the same problem anymore: <FROGGS> r: all(my $c for ()) <p6eval> rakudo bf472b: OUTPUT«===SORRY!===␤Unable to parse expression in argument list; couldn't find final ')' at line 2, near "for ())"␤»
Download (untitled) / with headers
text/plain 911b
I'm not sure this is a bug. The postfix for is a statement modifier, and it's being used in an argument list context. For it to parse right, you'd have to do something like this: all( do { my $c for () } ); or even all( (my $c for ()) ); I didn't test the version with the balanced sub, but I guess it would require something similar. -Scott On Wed Feb 15 06:37:15 2012, masak wrote: Show quoted text
> <masak> nom: sub balanced { all((my $c += $_ eq "[" ?? 1 !! -1) < 0 > for $^s.comb) && !$c }; .say when &balanced for (^(2 ** > 6))».fmt("%06b")».trans("01" => "[]") > <p6eval> nom bd5adb: OUTPUT«===SORRY!===␤Redeclaration of symbol $c␤at > /tmp/f7OZkWSnoP:1␤» > <masak> huh. > <masak> nom: all(my $c for ()) > <p6eval> nom bd5adb: OUTPUT«===SORRY!===␤Redeclaration of symbol $c␤at > /tmp/XLWPyMzIwp:1␤» > <masak> that's the shortest I can make it. > * masak submits rakudobug
-- perlpilot
This wasn't updated in a while. As of today (2017.11,HEAD(e5b660e)), it still complains about final ) like mentioned in one of the recent comments. And yes, this tickets seems to be rejectable.

On 2015-07-20 09:27:25, duff wrote:
Show quoted text
> I'm not sure this is a bug. The postfix for is a statement modifier,
> and it's being used in an argument list context. For it to parse
> right, you'd have to do something like this:
>
> all( do { my $c for () } );
>
> or even
>
> all( (my $c for ()) );
>
> I didn't test the version with the balanced sub, but I guess it would
> require something similar.
>
> -Scott
>
> On Wed Feb 15 06:37:15 2012, masak wrote:
> > <masak> nom: sub balanced { all((my $c += $_ eq "[" ?? 1 !! -1) < 0
> > for $^s.comb) && !$c }; .say when &balanced for (^(2 **
> > 6))».fmt("%06b")».trans("01" => "[]")
> > <p6eval> nom bd5adb: OUTPUT«===SORRY!===␤Redeclaration of symbol
> > $c␤at
> > /tmp/f7OZkWSnoP:1␤»
> > <masak> huh.
> > <masak> nom: all(my $c for ())
> > <p6eval> nom bd5adb: OUTPUT«===SORRY!===␤Redeclaration of symbol
> > $c␤at
> > /tmp/XLWPyMzIwp:1␤»
> > <masak> that's the shortest I can make it.
> > * masak submits rakudobug




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org