in reply to Lexical pad / attribute confusion
The following is mostly an educated guess, as I have not actually grokked the guts first hand.
It seems that both of these effects hinge on the duality of my having effects both at compile as well as runtime. Sprinkle a couple BEGIN { AttrTest->dump_lex('begin(1)') } in there and it becomes obvious that the pad gets fully populated during compilation, with all variables ever associated with the current pad being visible regardless of scope. In contrast, at runtime, the pad only contains those variables which are in scope - in fact, a variable doesn't appear in the pad before the entire statement during which it is declared has executed. It's for that reason that you can write my $x = 10; { my $x = $x; print $x } and get 10.
End educated guess.
Now with that, on to address each piece of the puzzle:
Makeshifts last the longest.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Lexical pad / attribute confusion
by djantzen (Priest) on Dec 22, 2002 at 01:37 UTC | |
by diotalevi (Canon) on Dec 22, 2002 at 02:37 UTC | |
Re^2: Lexical pad / attribute confusion
by adrianh (Chancellor) on Dec 22, 2002 at 01:58 UTC | |
by djantzen (Priest) on Dec 22, 2002 at 02:05 UTC |