in reply to Re^4: my (0?$a:$b): a koan
in thread my (0?$a:$b): a koan

What the reason is that my(my $x) and my(0?$x:$y) are accept isn't clear to me.

my(0?$x:$y) gets constant-folded to valid my($y). The validity checker apparently runs after constant-folding.

$lex and my $lex are the same op. The only difference is the LVINTRO flag. The validity checker apparently doesn't check the flag.

Can't localize lexical variable $x

This is consistent with my guess at the workings, that any variable lookup in the my argument expression is taken to be a lexical declaration. local craps out on the lexical passed to it. (Don't forget, local doesn't declare variables.)

Replies are listed 'Best First'.
Re^6: my (0?$a:$b): a koan
by ambrus (Abbot) on May 05, 2011 at 19:24 UTC

    Constant-folding can confuse the interpreter? Impossible!

      You keep using that word. I do not think it means what you think it means. </Inigo>
        Constant folding is not involved in his obfu, but his obfu uses exploits a bug of the same class as the one being discussed: A product of the source code is used as a proxy for the original source code, and it's not up to the job.