Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: ChainMap of Hashes on CPAN?

by sundialsvc4 (Abbot)
on Mar 25, 2013 at 15:17 UTC ( #1025323=note: print w/ replies, xml ) Need Help??


in reply to ChainMap of Hashes on CPAN?

The only time where I have seen this done is where there were several different name-spaces in play, and they did have a visibility-hierarchy relative to one another (such as local vs. global symbols), and the entirety of a name-space was created and then thrown away many times as the program ran.   You unquestionably could human-notice the time that it took to run through all the hashes on a hash-miss, but it was a price to be paid.

Absent such considerations, though, I generally approach this problem by simply creating one hash into which every symbol encountered is added, but never removed.   The symbol’s hash-entry points to a record/object in which the various meanings-of-the-moment are maintained in a list.   (A symbol might appear in the hash but have no current meanings at all, and in the application that I am thinking about, the same names tended to be re-used many times.   The price of insertion was paid but once, and the price of removal from the hash, not at all.)


Comment on Re: ChainMap of Hashes on CPAN?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025323]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2015-07-05 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls