Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Mutator chaining considered harmful

by Anonymous Monk
on Dec 31, 2004 at 06:29 UTC ( #418475=note: print w/ replies, xml ) Need Help??


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

Re: And that's different from storing the result of a method (whether said method is a mutator or something else) in a variable, and call a method in said variable?

Yes, it is. Consider:  $people->bob->eye('green')->color; . As a reader, I assume that the call is returning an 'eye' object, not bob, again. But if eye's a mutator, then you might find out Bob's a brown man.

Re: You mean, it makes it difficult to change a method such that has a different return value? Well, that always is non-backwards compatible. Whether the user chains, or stores the result in a variable and does something with the variable, it's going to be non-backwards compatible. In most cases you can make it backwards compatible through Want.pm. But perhaps, this is an issue of my style...?


Comment on Re^3: Mutator chaining considered harmful
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-07 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls