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."

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'.

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.

What's right here?  Should we die when defining a block or sub with a
variable before a placeholder of the same name?

Kyle.

Reply via email to