in reply to "Indirect" object syntax?

Hello muba,

Here’s the official explanation, from perlglossary:

So in the case of $cgi = new CGI;, this is actually short for something like:

@args = (); $cgi = new CGI @args;

Does an expression such as $cgi = new CGI; violate the English rule that an indirect object is not present unless a direct object is also present? Yes, unless the (null) method arguments can be said to be “understood” in this case. (Cf. the sentence “Listen to me!” in which the subject “you” is also said to be “understood.”)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: "Indirect" object syntax?
by jdporter (Paladin) on Nov 23, 2015 at 15:14 UTC
    In Perl, print STDOUT "$foo\n"; can be understood as "verb indirect-object object", where STDOUT is the recipient of the print action, and "$foo" is the object being printed.

    Except that that's wrong. "$foo" is not an object -- direct or otherwise.

    Properly,

    method $object @args;
    is "indirect object syntax", in Perl lingo, and
    $object->method( @args );
    is "direct object syntax". Same object; only the syntax is different. And English grammar terminology doesn't really apply well.

    And the fact that @larry decided in their infinite (ly mistaken) "wisdom" to coin a completely unnecessary and superfluous alternative term for object, namely "invocant", manifests their misunderstanding of what an object is, in object-oriented programming. For "invocant" means, quite simply, "caller". But in print $fh or $fh->print, $fh is not the caller, it is the receiver. It is the object, not the subject, of the action.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Re^2: "Indirect" object syntax?
by muba (Priest) on Nov 23, 2015 at 04:50 UTC
    Hope that helps,

    That explains it perfectly. Thank you!