in reply to Re^8: Mutator chaining considered harmful
in thread Mutator chaining considered harmful

So, basically you are saying you don't think the method names are picked appropriately?
No, that's not what I'm saying.
Let's go through your argument. You said:
It is more difficult to decipher, because it's ambiguous. The ambiguity must be resolved somehow. In the first example, you have to follow the chain of methods and know what type of thing they return. In the 2nd example, the variable name and usage is a big clue that helps resolve the ambiguity.
Which to me means that you are purely relying on the name of the temporary variable to document what the (first) method returns. And this is because you otherwise don't know what's being returned. However, variable names follow the same rules as method names. Hence, if a variable name can document what value it contains, so can a method name. But you couldn't determine from the method name what it returned.

Hence the conclusion that you find the method name used inappropriately.

  • Comment on Re^9: Mutator chaining considered harmful

Replies are listed 'Best First'.
Re^10: Mutator chaining considered harmful
by ihb (Deacon) on Jan 03, 2005 at 20:37 UTC

    He said "the variable name and usage".

    His point is that

    $foo->bar($x)->baz($y)
    can be either
    $foo->bar($x); $foo->baz($y); # same object
    or
    my $bar = $foo->bar($x); $bar->baz($y); # different object
    which is the ambiguity he's talking about.

    ihb

    See perltoc if you don't know which perldoc to read!
    Read argumentation in its context!