in reply to Re^2: Experimenting with Lvalue Subs
in thread Experimenting with Lvalue Subs
...you would have to evaluate the right hand side before the left hand side...
I'm not sure that I understand you. The right-hand side of an assignment is always evaluated before the assignment can occur? Except maybe in the case of assigning a constant, but even then the value of that constant is fetched from wherever before it can be assigned to the lvalue.
It's quite possible that I do not fully grasp the purpose or magic that lies behind the implementation of lvalue subs, but any code in an lvalue sub is invoked as a sideeffect of the assignment to an lvalue sub:
{ my $x; sub x: lvalue { print 'fred'; $x } }; x = 123; fred
The problem is that you can't do anything useful with that code as you cannot affect the outcome of the assignment relative to the value being assigned.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Experimenting with Lvalue Subs
by fergal (Chaplain) on Jan 24, 2005 at 23:39 UTC | |
by BrowserUk (Patriarch) on Jan 24, 2005 at 23:59 UTC | |
by Aristotle (Chancellor) on Jan 25, 2005 at 00:06 UTC | |
by BrowserUk (Patriarch) on Jan 25, 2005 at 00:31 UTC | |
by Aristotle (Chancellor) on Jan 25, 2005 at 01:23 UTC | |
|