On Sat Mar 06 05:23:08 2010, masak wrote:
> <masak> when I write 'our sub foo', the scope of the parameters in the
> signature of foo is a global scope rather than a lexical scope, yes?
> <TimToady> uh, no
> <TimToady> only 'foo' is aliased
> <masak> so, how about this?
> <masak> rakudo: my $a = 1; sub foo() { my $a = 2; our sub bar($x where
> $a) { say $x } }; bar(1); bar(2)
> <p6eval> rakudo 974d9a: OUTPUT«1␤Constraint type check failed for
> parameter '$x' [...]
> <TimToady> looks like it's getting the wrong $a to me
> * masak submits rakudobug
> <TimToady> ($a isn't a parameter though)
> <pmichaud> sub foo() { my $a = 2; our sub bar($x where $a) { say $x }
> }; bar(2);
> <pmichaud> rakudo: sub foo() { my $a = 2; our sub bar($x where $a) {
> say $x } }; bar(2);
> <p6eval> rakudo 974d9a: OUTPUT«Symbol '$a' not predeclared in bar
> [...]
> <pmichaud> looks like the where clause is attached to the wrong outer
> scope
> <TimToady> it does at that

Current behavior:

20:20 < [Coke]> rakudo: my $a = 1; sub foo() { my $a = 2; our sub bar($x where 
                $a) { say $x } }; bar(1); bar(2)
20:20 <+p6eval> rakudo 38907e: OUTPUT«Could not find sub &bar␤  in block <anon> 
                at /tmp/XCB2X1q5A9:1␤  in <anon> at /tmp/XCB2X1q5A9:1␤»
20:20 < [Coke]> rakudo: sub foo() { my $a = 2; our sub bar($x where $a) { say 
                $x } }; bar(2);
20:20 <+p6eval> rakudo 38907e: OUTPUT«Could not find sub &bar␤  in block <anon> 
                at /tmp/hSS1YJsEDY:1␤  in <anon> at /tmp/hSS1YJsEDY:1␤»


-- 
Will "Coke" Coleda

Reply via email to