in reply to Re: Re: Re^3: chaining method calls
in thread chaining method calls

The way I see this idiom used is fairly consistent. $self is only returned for mutators (upon success). Thus, the expectations are clear: mutators always return $self upon success and accessors never return $self.

Consistent or not, because there's no first-class support for cascading in Perl, the reader is forced to do a lot of digging to distinguish a simulated cascade from sloppy coupling. Basically, to be sure, you have have to read all of the methods. In a first-class cascade (like those supported by Smalltalk) a surface read is sufficient.

  • Comment on Re: Re: Re: Re^3: chaining method calls