in reply to Re^5: Experimenting with Lvalue Subs
in thread Experimenting with Lvalue Subs
Then, with respect, I think that you and I are reading different threads.
And that maybe you have missed all the discussion around the use of lvalue subs for accessors and mutators over the past 2 1/2 years. Literally every time the subject has come up, their use has been nearly universally rejected because of the absence of the ability to validate the assignment, without the resort to hookey, repetative and slow tieing of the underlying lvalue that is assigned. Every time.
Even with the slightly streamlines syntax outlined in Apo6, it is still forcing the programmer to code additional and complicated code for every attribute of every class. Extra work in what will be the common case for--as best as I can tell--the purpose of avoiding it in the particular and less common case.
For me, that renders the one feature of P6 that, aboe all others, I was looking forward to, almost useless. Better to stick with the current:
sub getset { my self = shift; return $self->{thing} unless @_; die "Bad value" unless $_[0] =~ /valid/; $self->{thing} = $_[0]; }
It's easier to code. Easier to read. Easier to debug. And probably quicker.
I'll refrain from passing further comments on P6 related matters, because I think I just joined that band of people who will probably never use P6.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Experimenting with Lvalue Subs
by Aristotle (Chancellor) on Jan 25, 2005 at 04:10 UTC | |
by TimToady (Parson) on Jan 25, 2005 at 19:30 UTC | |
by BrowserUk (Patriarch) on Jan 25, 2005 at 10:56 UTC |