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

Specifically, the "default to '$_'/'@_'" functionality is modeled after default pronouns in English, and is certainly a key concern of this thread.

sorry, maybe it's trivial, but what is the default pronoun in English?

Cheers Rolf

Replies are listed 'Best First'.
Re^7: why does push not default to $_?
by Lawliet (Curate) on Dec 07, 2008 at 04:03 UTC

    "Print, photocopy, and fax it" where the first two verbs are referring to "it". Not really sure if this works as a good example, though.

    I'm so adjective, I verb nouns!

    chomp; # nom nom nom

      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.

        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.)

        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

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

        for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";
Re^7: why does push not default to $_?
by pobocks (Chaplain) on Dec 08, 2008 at 04:37 UTC

    It's not trivial, don't worry...

    There's no specific "Default pronoun" in English, per se -- it's more that, in certain circumstances, one of several English pronouns can be defaulted to (assumed). The most common of these is probably the implied "you" that imperative statements have, but there are other circumstances (None of which I can compose off the top of my head, because I'm sleep deprived. I'll try to think up some later.)

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