...implemented as coroutines which are expected to yield the lvalue.
Not really. I may appear that way, but coroutines flip back and forth. This doesn't.
In actuality, there would be very little difference between this and using a tie/STORE method to validate.
Except in this case the "STORE method" is the code inline from the LVALUE statement to the end of method.
One distinct difference between this and a tie/STORE method, is that if the lvalue in question is an array or a slice of an array, the "callback code" would only be called once. Not once for every value in the list being assigned.
I am still unsure what happens in the calling code if the STORE method (disguised or not) rejects the attempt to store a value?
I also thought about whether the PRE/POST or ENTER/LEAVE blocks associable with a method could be used to provide for a single place in which all validation is done, but my reading of the Apos & Syns leaves me very confused about when these get called, if ever, with an lvalue sub.
Of course, this whole discussion is a waste of time. Who are we to question whether there is a better way? Explain to plebians. Pah!
In reply to Re^3: Assignable Subroutines
by BrowserUk
in thread Assignable Subroutines
by dragonchild
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |