Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: Why does Perl have typeglobs? (pads)by tye (Sage) |
on Jul 10, 2014 at 01:13 UTC ( [id://1092989]=note: print w/replies, xml ) | Need Help?? |
Where did you read the word "need"? If you want to use Perl's PADs as part of an argument against how symbol tables were implemented, then you probably should learn more about Perl's PADs first. Perl's PADs don't support looking things up by name so they'd really suck as an implementation of a symbol table. That's why that module has "walker" in its name. Plus PADs only support about half of the slot types of a typeglob. The obvious two choices are 1) a hash by name where each value has N slots for N types of things; 2) N hashes. If you have a complete set of sigils, then the third obvious choice is 3) a hash by "$sigil.$name" (where the values are of various types) but that might not be the best choice in C (and we don't have a complete set of sigils). The choice of typeglobs is more obvious in older features of Perl where "open FOO" then "write FOO" will use $FOO as the name of the file to open, *FOO as the handle to open, and FOO as the format to write. Even more slots of *ARGV are used together. - tye
In Section
Seekers of Perl Wisdom
|
|