On Son, 02 Sep 2001, Brent Dax wrote:

> <rant type="possibly-incorrect" onincorrect="correct-without-flames">
> 
> Currently, in Perl 5, my() variables are stored in a totally separate
> way from normal our()/local() variables, in an array-of-arrays
> structure.  This means that my() variables are second-class citizens.
> The opcodes to look up a my() variable are separate from the opcodes for
> an our()/local() variable.
> 
> >From my point of view, this seems dumb.
> 
> Is there any real reason my() variables are stored in a pad instead of a
> symbol table?  It seems more natural that they would be stored in a
> symbol table, since symbol tables are designed to hold variables.  It
> also seems like it would allow us to implement 'my sub'.
> 
> Of course, this has long been in Perl 5; I don't think it could be
> changed at this point.  However, we're now doing the same thing with
> Perl 6.  As if it didn't seem stupid enough as is, we're supposed to
> simulate at least some of the functionality of a symbol table through
> the MY:: pseudo-package.
> 
> Once again, why isn't MY:: stored in some sort of anonymous symbol
> table?  This would allow us to do all the things we can normally do with
> a global, without the hassles of writing a magical pseudo-package.

Scoped variables cannot be stored on any sort of flat table.  Such too
simple schemes cannot deal with variable coming in and out of scope, or
variable hiding another without contorsions elsewhere. So you really need
more complex mechanisms like scratchpads.

my $a=1;
{
  my $a=2
}


> 
> </rant>
> 
> --Brent Dax
> [EMAIL PROTECTED]
> 
> "...and if the answers are inadequate, the pumpqueen will be overthrown
> in a bloody coup by programmers flinging dead Java programs over the
> walls with a trebuchet."
> 

-- 
Stéphane Payrard -- [EMAIL PROTECTED]

Reply via email to