|Perl Monk, Perl Meditation|
Re^10: Experimenting with Lvalue Subsby BrowserUk (Pope)
|on Jan 25, 2005 at 15:35 UTC||Need Help??|
First off, you are assuming that an lvalue sub has to expose an actual attribute of the object.
Which is understandable as with the current P5 implementation and the proposed P6 implementation, where you cannot do anything after the assignment takes place--you are right.
But now imagine that the method was passed the rvalue when the method was invoked. Now you can do anything with it, like validate it, but also use it to derive some other value or a whole collection of values that then are then assigned to attributes of your object--none of which happen to have the same name as the method invoked.
The desirable feature is not the direct access to the underlying entity, it is the syntax that allows:
in preference to
Whether thing is actually a piece of ram within the object or a conceptual attribute of it is secondary.
Equally, whether that example has to "call the function twice", once to get the value and once to modify it, is an implementation detail that should be transparent.
Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.