in reply to Re^5: Experimenting with Lvalue Subs
in thread Experimenting with Lvalue Subs
It seems to me that you are viewing :lvalues as a C programmer would, something that behaves as a piece of memory. Wheras most people here are viewing lvalues as a VB or Java programmer would: disguised method calls. Maybe the solution is to provide both? I sure would like to have a way for
be the same as$obj->method=$foo;
$obj->method($foo);
It would be nice if Perl automagically made
$obj->method++;
be the same as
$obj->method($obj->method()+1);
But it wouldn't bother me too much if it didn't.
The point here is that folk would be happy to forgo some of the more extreme uses of :lvalue subs like you and ysth post if they could just easily write validation code for the simpler cases. And we'd really like to do it in Perl 5. :-)
UPDATE: This was discussed in the CB and there seemed to be some agreement that there is room for the souped up, can do anything :lvalue as well as a more constrained :assignable version that has much simpler semantics. In fact it seems to me that the :assignable version could probably be implemented with :lvalue and better callbacks once Perl 6 is around tested and stable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Experimenting with Lvalue Subs
by dragonchild (Archbishop) on Jan 25, 2005 at 14:32 UTC | |
by demerphq (Chancellor) on Jan 25, 2005 at 15:03 UTC | |
by Juerd (Abbot) on Jan 25, 2005 at 22:55 UTC | |
by dragonchild (Archbishop) on Jan 25, 2005 at 15:09 UTC | |
by demerphq (Chancellor) on Jan 25, 2005 at 15:23 UTC | |
by BrowserUk (Patriarch) on Jan 25, 2005 at 15:35 UTC |