RE: Define consistent and standard
[email protected] (Garrett Goebel) Mon, 7 Aug 2000 09:57:16 -0500
| Newsgroups | perl.perl6.stdlib |
|---|---|
| Message-ID | <71BEC0D4E1DED3118F7A009027B1202835C828@EXCH_MISSION> |
From: [email protected] [mailto:[email protected]] > > * 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