在 2006/6/24 上午 8:41 時,Patrick R. Michaud 寫到:
because later in the scope $x may be declared, so it's safer to just put OUTER right there.I don't think $x can be declared later in the scope. According to S04,If you've referred to $x prior to the first declaration, and the compiler tentatively bound it to $OUTER::x, then it's an error to declare it, and the compiler is allowed to complain at that point.
Hmm, looks like it's been changed this April. In that case, indeed the emitter can safely remove the implicit OUTER calls. Pugs's Parrot backend has been updated accordingly. Thanks!
(...and Cc'ing p6l for the part below)
However, the spec wording is ambiguous:
$x = 1 if my $x;
The compiler is "allowed" to complain, but does that means it's also
okay to not die fatally, and recover by pretending as if the user has
said this?
# Current Pugs behaviour
$OUTER::x = 1 if my $x;
If it's required to complain, then the parser need to remember all
such uses and check it against declaration later, and it'd be better
to say that in the spec instead.
Thanks, Audrey
PGP.sig
Description: This is a digitally signed message part
