Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: "Redundant" ne "Bad"

by earthboundmisfit (Chaplain)
on Oct 31, 2002 at 00:48 UTC ( [id://209297]=note: print w/replies, xml ) Need Help??


in reply to "Redundant" ne "Bad"
in thread the "@" indicates plural hence "s" is redundant

At first, I was obdurately convinced that this is the only "correct" way to think of array naming. The author's rep may have influenced my conviction slightly ;) But on the drive home tonight it suddenly dawned on me that there really is something to what princepawn is saying, something I couldn't see or understand at first. Consider:
a murder of crows
a surfeit of skunks
a bag of potatoes
You wouldn't pluralize 'murder' or 'surfeit' if you were referring to just one collective of crows or skunks. Stated another way and to further explain what I think princepawn means is 'it's the potatoes that gets the plural 's' not the thing holding them.' It's sort of a reverse synecdoche that leads us to pluralize the array name.

Funny how I feel no compulsion to pluralize the array name when I actually use the word 'array' in it:

@myArray = qw(crow skunk soldier); @codeArray = (&get_code(3,500)); my @bigAssArray = qw(donkey mule burro);
That said, I personally cannot shake the readability of using pluralized array names and will most likely continue to do so unless, of course, I'm using some crazy English to C translator that can't distinguish what I mean from what I say ;)

Replies are listed 'Best First'.
Re: Re: "Redundant" ne "Bad"
by Juerd (Abbot) on Oct 31, 2002 at 08:34 UTC

    Funny how I feel no compulsion to pluralize the array name when I actually use the word 'array' in it.

    I never use the word 'array' in an array name. It's completely redundant. The same goes for hashes and scalars: I never have %function_hash or $username_scalar.

    I do use 'array' and 'hash' to name references. If you read $array in my code, you can be sure it's a reference to an array. Some people use $arrayref or even $array_reference, but 'ref' is useless information, imho, because a scalar simply cannot be an array. (Okay, I'm ignoring overloading now)

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-19 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found