Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^8: why does push not default to $_?

by ikegami (Patriarch)
on Dec 07, 2008 at 13:05 UTC ( [id://728699]=note: print w/replies, xml ) Need Help??


in reply to Re^7: why does push not default to $_?
in thread why does push not default to $_?

No, the subject of those three verbs is an unstated "you". "It" is the direct object. But the pronoun wasn't optional. Imperative verbs can't have a explicit subject.

Replies are listed 'Best First'.
Re^9: why does push not default to $_?
by LanX (Saint) on Dec 07, 2008 at 14:24 UTC
    So the default pronoun is the "you" in imperativ forms? I'm sure it can't be so different in Latin ...(e.g. "Vade retro (Satanas)!" )... so thinking Perl has to be unorthogonal because English is, is a little speculative.

    "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

      So the default pronoun is the "you" in imperative forms?

      There's no default. It can equally be "you" (singular) and "you" (plural) and "we" (plural).

      Anyway the direct object "it" is the equivalent to $_,

      But the "it" isn't optional. "eat" and "eat it" are not synonymous.

      I'm not sure why you guys are comparing English with Perl. There might be similarities, but the differences are more numerous. It's not helping you at all.

        > There might be similarities, but the differences are more numerous. It's not helping you at all.

        that's what I'm trying to show. Whenever I try to discuss about the inner mechanisms of perl, this myth arises:

        "Perl doesn't have to be logical, it's modelled after a human language"

        These are not contradictary goals!!!

        Cheers Rolf

Re^9: why does push not default to $_?
by Porculus (Hermit) on Dec 07, 2008 at 14:08 UTC

    Of course, you're already making the assumption that the example was an imperative sentence. It could just as easily have been the answer to the question "what do you think Fred should do with that email?"

    (I don't think I really have a point, other than that natural language, like Perl, is highly context-sensitive. Similar ambiguities arise in languages other than English, even those such as Japanese that are sometimes claimed to be logical and consistent by people who don't know much about them.)

Re^9: why does push not default to $_?
by pobocks (Chaplain) on Mar 28, 2009 at 14:28 UTC

    Ikegami, reconsider your stance on imperative verbs. ;-)

    for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";
      I don't remember what the "Ikegami," is called, but it's not considered the subject. It's still the implied "you". Of course, that implied "you" is defined by the "Ikegami,". Nice try, though (++).

        Huh. I thought in named imperatives, the thing commanded was the subject; if not in grammatical exactness, it still works thus in practice.

        Sigh... Only four years out, and my Lit Major powers are already faded. Oh well ;-)

        for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

Log In?
Username:
Password:

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

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

    No recent polls found