At 06:59 PM 8/1/00 +0100, Hildo Biersma wrote:
>Dan Sugalski wrote:
> >
> >
> > I'd also like to see lexicals addressed by name through some sort of symbol
> > table-ish thing. Maybe:
> >
> >    $PAD{my_var}[-1]
> >
> > would give a ref to the lexical my_var that exists one level of scope out
> > from the current, or at least the my_var that's masked by the most recent
> > declaration of my_var. (So [0] is the current, [-1] the next most recent,
> > [-2] the one outside that, and so on)
>
>I like the idea... it's evil.  (I hope it never makes it into the
>language though.)

Damn straight! (And why?)

   my @lexicals = keys %PAD;

would be quite nice. Folks would kill (or at least inflict really nasty 
paper cuts) to have this available in the debugger.

>Can you imagine doing this for 'local'?  That would lead to some pretty
>neat obfuscated code...

Sure. long_distance($var, -1) could give the most-recently-localized 
version of $var. :-)

I'd rather not do it for globals, though. (Actually I'd be just as happy to 
see local go missing entirely, but that's just me looking at the guts...)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to