Re: What's MY.line?
On Tue, Jul 09, 2002 at 09:50:26PM -0400, Chip Salzenberg wrote: Based on what I rememeber from the long threads about this, >3. Is C<%MY> intended to reflect the PAD? loosely speaking yes. > > 3a. If so, how can one distinguish among the e.g. many C > variables declared within the current function? It was decreed that %MY only sees stuff in the inner-most lexical scope (so the Perl6 version of a pad is 'bigger' than what %MY sees): { my $x = 1; { exists %MY::{'$x'}; # false print %MY::{'$x'}; # undef print $x; # 1 %MY{'$x'} = 2; print %MY::{'$x'}; # 2 print $x; # 2 { exists %MY::{'$x'}; # false print %MY::{'$x'}; # undef print $x; # 2 } } exists %MY::{'$x'}; # true print %MY::{'$x'}; # 1 print $x; # 1 } > > 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>. I think the main intent of %MY:: is to allow import() to lexically affect the caller, ie sub import { caller(1).MY{'&foo'} = sub { ... }; } (for some vague handwaving interpretation of caller() and MY) Dave. -- My get-up-and-go just got up and went.
Re: What's MY.line?
At 9:50 PM -0400 7/9/02, Chip Salzenberg wrote: >3. Is C<%MY> intended to reflect the PAD? Yes. > 3a. If so, how can one distinguish among the e.g. many C > variables declared within the current function? One pad per block, rather than per sub. -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: What's MY.line?
At 04:24 PM 7/10/2002 +0100, [EMAIL PROTECTED] wrote: >Dan Sugalski <[EMAIL PROTECTED]> writes: > > > At 9:50 PM -0400 7/9/02, Chip Salzenberg wrote: > > >3. Is C<%MY> intended to reflect the PAD? > > > > Yes. > >Hey! How's this for a scary thought: > >$continuation.the_pad > >I'll get my coat. Hah, good try! I think this would be easy for Parrot. A continuation object will have all of its context encapsulated already, including the lexical pad stack. Assuming the existence of this mystical beast, it could work like: %continuation.the_pad{'$foo'} -Melvin
Re: What's MY.line?
Chip Salzenberg wrote in perl.perl6.language : > In (re?)examining the Apocalypses, I've found something that confuses me a > bit. A2 refers to C as a "pseudopackage" and says: > > __LINE__ becomes MY.line > __FILE__ " MY.file > [...] > > With regard to C: > >2. What are "line" and "file"? Properties? Class variables? > (Probably not class variables since C is not called a class.) That's the implementation problem ;-) In perl 5, __LINE__, __FILE__ and __PACKAGE__ are replaced at compile-time (in fact, at tokenizing-time) by the appropriate constants. The question is : to which kind of bytecode MY.file (etc.) get compiled ? -- Rafael Garcia-Suarez : http://use.perl.org/~rafael/
Re: What's MY.line?
At 4:24 PM +0100 7/10/02, [EMAIL PROTECTED] wrote: >Dan Sugalski <[EMAIL PROTECTED]> writes: > >> At 9:50 PM -0400 7/9/02, Chip Salzenberg wrote: >> >3. Is C<%MY> intended to reflect the PAD? >> >> Yes. > >Hey! How's this for a scary thought: > >$continuation.the_pad What's that supposed to do, though? You want to alter the pad that gets put in place at the top of the pad list for a continuation? No problem. A bad idea, mind, but no problem... :) -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: What's MY.line?
At 10:12 PM + 7/10/02, Rafael Garcia-Suarez wrote: >Chip Salzenberg wrote in perl.perl6.language : >> In (re?)examining the Apocalypses, I've found something that confuses me a >> bit. A2 refers to C as a "pseudopackage" and says: >> >> __LINE__ becomes MY.line >> __FILE__ " MY.file >> >[...] >> >> With regard to C: >> >> 2. What are "line" and "file"? Properties? Class variables? >>(Probably not class variables since C is not called a class.) > >That's the implementation problem ;-) >In perl 5, __LINE__, __FILE__ and __PACKAGE__ are replaced at >compile-time (in fact, at tokenizing-time) by the appropriate constants. >The question is : to which kind of bytecode MY.file (etc.) get compiled ? Well, unless they're accessible symbollically, there's no difference between __LINE__ and MY.line. Just string constants to compare against... -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk