[Chicago-talk] PBP - What to name a hash_ref?

Jay Strauss me at heyjay.com
Thu Oct 6 22:33:04 PDT 2005


Paul Baker wrote:
> On Oct 5, 2005, at 9:55 PM, Jay Strauss wrote:
> 
> 
>>In PBP (I haven't finished it yet) but so far he hasn't recommended a
>>naming for a hash_ref.
>>
>>hashes are blah_of
>>refs are blah_ref->
> 
> 
> I haven't gotten my copy yet. What's the reasoning behind the _of for 
> hashes?
> 

Actually on re-reading, PBP recommends ending the hash name in a 
preposition specifically:

"Moreover, because hashes often store a property that's related to their 
key, it's often even more readable to name a hash with a singular noun 
followed by a preposition"

$author_of{'Perl Best Practices'} = 'Damian Conway';

Ironically, he goes on to give some examples that don't end in a 
preposition.  I guess it's more of a guide-line.  Try to make it read 
naturally.

Jay



More information about the Chicago-talk mailing list