On Thu, Jul 30, 2009 at 10:29:04AM -0500, Kyle Hasselbacher wrote:
> In Rakudo right now, this lives:  "{$foo;$^foo}(1)"
> 
> However, the spec test expects it to die during compilation (see the
> end of S06-signature/positional-placeholders.t).  It says, "A
> non-twigil variable should not precede a corresponding twigil
> variable."

The spec is correct.  Rakudo currently has some issues with
order-of-lexicals declarations.


> In Rakudo right now, this says 3:  sub foo { my $a = 3; say $^a };
> foo(5);  # RT #64310
> The spec test would seem to imply that this should die during the
> definition of 'foo'.

Rakudo should complain about the placeholder attempting to redefine $^a.
I don't know if that elevates to the level of "die", though; STD.pm
seems to treat it as a "potential difficulty".

> On the other hand, if we swap the statements, it merely complains that
> $a is redeclared and then croaks because we assigned to a read-only
> variable.
> 
> sub foo { say $^a; my $a = 3 }; foo(5);
> Redeclaration of variable $a
> 5
> Cannot assign to readonly variable.

Rakudo is correct that it's a redeclaration and that the
variable (parameter) is readonly and cannot be assigned to.

Pm

Reply via email to