develooper Front page | perl.perl6.internals | Postings from September 2001

Should MY:: be a real symbol table?

Thread Next
Brent Dax
September 2, 2001 03:07
Should MY:: be a real symbol table?
Message ID:
<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.


--Brent Dax

"...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."

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About