On Sat, 5 Oct 2002, Michael Lazzaro wrote:
> Dan Sugalski wrote:
> >
> > There won't be any direct access to attributes outside class methods
> > of the class that defines the attributes, unless Larry changes his
> > mind in a big way. (And, honestly, probably not even then) Instead
> > it'll all be accessed via lvalue methods. If an attribute is exposed
> > there's just an lvalue method created, if it's not exposed there
> > isn't.
>
> Ack! Hold on, there: I'm being told that Damian thinks lvalues are
> probably out, and that Larry thinks that pseudo-attributes will be made
> accessed through the use of lvalues. Please confirm, which is it? I
> don't particularly care, I just want to write an example down in
> best-guess form.
I think everyone agrees that some sort of simple accessor syntax will be
included (instead of the getX/setX hack). But will accessors _look_ like
attributes or methods?
# look like methods
object.foo($value);
# look like attributes
object.foo = $value;
Personally, I hope they look like attributes. But if they do, the perl5
lvalue subs are not the way to do it. Why? Because an lvalue sub returns
a lvalue which get set _after_ the sub returns. At that point it is too
late for the sub to do anything useful with the new value.
~ John Williams