in reply to Re^8: why does push not default to $_?
in thread why does push not default to $_?
"Irregularities" in human languages derrive from abbreviation of frequent constructs, but the rules of abbreviation can be very regular. Only sometimes there are conflicts between regular abbreviation and standard constructs with different meaning, so one need an irregular abbreviation to distiguish the meanings (Can't find an example in English).
These conflicst are unavoidable in languages with a active vocabulary of 30000 words, but computer languages hardly have this extent ... (maybe except inhuman examples like PHP or Cobol ... ; )
Anyway the direct object "it" is the equivalent to $_, the direct object of "push it" is also $_. The reason why the "indirect object" @array is at first place in perl syntax, is because you can't push a list otherwise. Well and this breaks the analogy to English, since AFAIK the direct object has to be at first place...
"push $it,@to_array".
I remeber when I started Perl, I was frequently putting the array at the end of the push parameters! So we see Perl is already not readable the way AppleScript or HyperTalk is (thank God!)
Cheers Rolf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^10: why does push not default to $_?
by ikegami (Patriarch) on Dec 07, 2008 at 17:34 UTC | |
by LanX (Saint) on Dec 07, 2008 at 19:52 UTC | |
by pobocks (Chaplain) on Dec 08, 2008 at 04:29 UTC |