develooper Front page | perl.perl6.stdlib | Postings from August 2000

RE: Define consistent and standard

Thread Previous | Thread Next
From:
Garrett Goebel
Date:
August 7, 2000 07:58
Subject:
RE: Define consistent and standard
Message ID:
71BEC0D4E1DED3118F7A009027B1202835C828@EXCH_MISSION
From: skud@netizen.com.au [mailto:skud@netizen.com.au]
>
> * Plural variables should have plural names
> 	@employees, @items, %contact_details
> * Hash names should be written so that looking up an element 
> reads clearly:
> 	$email_address{Skud} reads as "the email address of Skud"

Shouldn't that be $email_addresses{Skud}?  Well I guess so if the following
rules apply...

> * Hashes with scalars as values should have singular names:
> 	my $address = $email_address{Skud};
> * Hashes with arrayrefs or hashrefs as values should have 
> plural names:

Is this really advised? 

Hashes and arrays hold _things_. Scalars hold a _thing_. I.e. Scalars are
singular and Hashes/Arrays plural. Seems pretty straight forward. Should we
really want to make the plural of a hash dependant on plurality of the
thing(s) contained in the hash? Sounds like a recipe for unnecessary
complexity.

Garrett

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About