Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: the "@" indicates plural hence "s" is redundant

by Juerd (Abbot)
on Oct 31, 2002 at 08:48 UTC ( [id://209367]=note: print w/replies, xml ) Need Help??


in reply to the "@" indicates plural hence "s" is redundant

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.

  • Comment on Re: the "@" indicates plural hence "s" is redundant

Replies are listed 'Best First'.
Re^2: the "@" indicates plural hence "s" is redundant
by Aristotle (Chancellor) on Oct 31, 2002 at 11:12 UTC
    'five cow' or 'three car' just doesn't make sense to me
    No, because that would be "fifth cow" and "third car". :-) You might also read @cow as "many a cow".

    Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://209367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2024-04-24 14:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found