in reply to Re^11: Perl OO and accessors
in thread Perl OO and accessors
It's not that I "changed" your premise so much as I disagree with your premise (and, implicitly, the conclusions you draw from it).
In the context of OO and objects, I take "attribute" to refer to data contained within an object. Quite often, it is a simple variable-like thingy, but it is not necessary that fetching the value of an attribute be idempotent. If an object has behavior, and that behavior is autonomous, then my scenario does hold.
Thinking in shell terms, consider the variables like RANDOM, SECONDS, etc. They change out from under you in a similar manner.
Besides, $o->foo isn't a variable. It's a CODEREF. If it's an lvalued CODEREF, then it can masquerade as a variable, and that can be useful, or could be if lvalue subs weren't so limited in what they can do (not to mention making it impossible to use the debugger). ${$o->foo} *would* be and look like a variable, but then you have those extra curly braces cluttering things up. *That's* what you should be comparing, and I find the aesthetics unfavorable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: Perl OO and accessors
by fergal (Chaplain) on Nov 30, 2005 at 16:42 UTC | |
by Perl Mouse (Chaplain) on Nov 30, 2005 at 21:13 UTC | |
by fergal (Chaplain) on Dec 01, 2005 at 00:58 UTC |