Front page | perl.perl6.language |
Postings from July 2002
What's MY.line?
Thread Next
From:
Chip Salzenberg
Date:
July 9, 2002 23:45
Subject:
What's MY.line?
Message ID:
20020710015025.GA11948@perlsupport.com
In (re?)examining the Apocalypses, I've found something that confuses me a
bit. A2 refers to C<MY> as a "pseudopackage" and says:
__LINE__ becomes MY.line
__FILE__ " MY.file
There is also Apocalypsal reference to C<%MY> as a name for the current
lexical symbol table.
First:
1. Is there any technical connection between C<MY> and C<%MY>?
I don't think there has to be. (Though I suppose you could
play entertaining tricks by manipulating C<%MY{MY}>.)
With regard to C<MY>:
2. What are "line" and "file"? Properties? Class variables?
(Probably not class variables since C<MY> is not called a class.)
And with regard to C<%MY>: Each function in Perl 5 has a single PAD that
could correspond to C<%MY>, except that PAD entries are indexed by a
combination of name and statement range. So:
3. Is C<%MY> intended to reflect the PAD?
3a. If so, how can one distinguish among the e.g. many C<my $foo>
variables declared within the current function?
3b. If not, how are lexical adjustments to C<%MY> unwound? Or are
they? If they're not, I can actually see the idea that could be
part of the base utility of C<%MY>.
3b1. But if they're not unwound, then the changes that *are* unwound
don't live in C<%MY>! For example:
if foo() { my $x = 1; print $x }
if bar() { my $x = 2; print $x }
The comings and goings of C<$x> in this code can't be
represented in C<%MY> (unless answer #3 above is "yes",
in which case this branch of questions is void).
Larry? Damian? Allison? ("Chief? McCloud?")
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"It furthers one to have somewhere to go."
Thread Next
-
What's MY.line?
by Chip Salzenberg