>>>>> "AS" == Aaron Sherman <[EMAIL PROTECTED]> writes:

  AS> On Wed, 2004-09-01 at 14:35, Uri Guttman wrote:
  >> the symbol table is just a special hash tree with
  >> global side effects. so why not just use a regular hash as it is safer
  >> (no global side issues), more flexible (you can pass it around, take
  >> references, create anonymous hashes) and you can create lexical hashes.

  AS> Pass it around:

  AS>   perl -le 'sub foo{print ${$_[0]{x}}}$x=1;foo(\%::)'

  AS> Take references: see above

oh, i meant do all those safely. of course you can take refs as it is
just a hash anyway (but with side effects). but passing around a ref to
a symbol table entry is leading to even more disasters at a
distance. passing refs to globs is an old perl technique (as is passing
globs themselves which dates from perl4).

  AS> Create anonymous hashes: hmmm I've never tried that.... hmmm....

  AS>   $anon_stash = \%{"__anon_stash__::"};
  AS>   delete $::{"__anon_stash__::"};
  AS>   # Now $anon_stash is truly anonymous

  AS> Oh, and yes, I agree that that's just wrong ;-)

that is my main point. there is no reason to use symrefs for data
structures and many reasons not to.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to