I like plurality in code, when appropriate. I think it's appropriate in array names. When I say code out loud, I tend to assume the listener is skilled in Perl and knows where to put which interpunction. 'arrays' will be @arrays and 'array' will be $array. The latter implies that it is a reference to an actual array, as scalars can't hold arrays.
I go a little further than just variable names. Often, I use plural function names to indicate that the function will return a list. In my DBIx::Simple, you can see what I mean: $result->hash will return a single hash (again, that being a reference to one is implied: a method cannot return a real hash), $result->hashes will return a list of hash(referenc)es.
I don't know any Chinese, and maybe I just want plurality because every language I know changes words (well, not always (sheep, fish)) when they become plural. 'five cow' or 'three car' just doesn't make sense to me, even though I should know there are multiple cows and cars, because of the numbers in front of them. @cow and @car seems strange. I prefer @cows and @cars.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
In reply to Re: the "@" indicates plural hence "s" is redundant
by Juerd
in thread the "@" indicates plural hence "s" is redundant
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |