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

Steven Lembark lembark at wrkhors.com
Mon Oct 17 16:15:32 PDT 2005

-- Jay Strauss <me at heyjay.com>

> Hi,
> 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->
> but:
> blah_of_ref->{} - doesn't sound right in my head
> and
> blah_ref_of->{} - doesn't look right based on the PBP rules
> Both seem to be getting kinda wordy

I've been using 'z' notation for about a decade:

    - strip any trailing vowels.
    - add a trailing 'z'.


    for my $name ( @namz )

    while( my ($k,$v) = each %$thingyz )

One thing that helps quite a bit is to just use ref's unless
there is a really good reason not to. There isn't much of a 
performance hit (zero in most real cases) and it also avoids
situations like:

There is little enough syntax to change from

    my %blah = ();


    my $blahz = {};

at which point you aren't mixing much of anything.

I_pronoun avoid_verb the_article technique_noun: there's 
enough to type and I can stop well short of golf and still
have readable code without them.

Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
lembark at wrkhors.com                                     1 888 359 3508

More information about the Chicago-talk mailing list