the only way I see of avoiding invoking an lvalue sub twice, whilst retaining the ability to undo lexically localised changes to it
But there is a simple way. If the lvalue sub is not responsible for changing the value itself, but rather only responsible for providing a normal lvalue ie a scalar or such, then you can use the same mechanisms to handle hypothetical values on that scalar or whatever it is as you do everywhere else — after all, there's nothing special about it.
Incidentally, that is exactly the situation we already have.
Your deferred assignment proposition OTOH is a non-starter if you consider that that same lvalue sub can itself serve as an rvalue in another occasion during the same dynamic scope. In fact, it (or the underlying effective lvalue assigned to) must serve as an rvalue somewhere at some point, because otherwise, what is the purpose of assigning a dynamically scoped value to it in the first place?
Makeshifts last the longest.
In reply to Re^10: Experimenting with Lvalue Subs
by Aristotle
in thread Experimenting with Lvalue Subs
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |