Re: RFC 118 (v1) lvalue subs: parameters, explicit assignment, andwantarray() changes
[email protected] ("David L. Nicol") Tue, 22 Aug 2000 22:16:50 +0000
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Organization | University of Missouri - Kansas City supercomputing infrastructure |
| Message-ID | <[email protected]> |
With a tied scalar, does perl5 access its routines
twice when it does a += ?
I think the lvalueable subroutine should get called twice
in the example, first the left-hand and then the right-hand
Nathan Wiger wrote:
>
> Damian Conway wrote:
> >
> > The lvalue accessor *shouldn't* be doing the assignment (what if an assignment
> > isn't what I want?).
> >
> > The (overloaded) operator = should do the assignment. To whatever lvalue
> > the lvalue subroutine returns.
> >
> > Or the "assignment" should be done by operator += or operator++ or
> > whatever mutator I'm actually applying to the returned lvalue.
>
> Good distinctions. So, if I'm reading you right, this won't work?
>
> @oldpath = $tree->path('L','R') = ('R');
>
> Basically, the lvalue sub by your definition is just a "stupid" accessor
> that returns an lvalue. @oldpath, by your definition, would have to
> contain ('R').
--
David Nicol 816.235.1187 [email protected]
Laziness with responsibility http://www.tipjar.com/kcpm