Re: Pass by Reference
- Posted by petelomax Jan 16, 2015
- 1850 views
I did point out that it's possible to get the same benefit in a different way
ditto
I've only just grasped the full extent of the call_func() issue and yes that gets horribly messy because it has to drag all this stuff out of the parser and right into the runtime/translator, for very little benefit.
If desequencing simply mandated that the LHS and the RHS must have the same number of elements, or else it's a run-time error, then simply using desequencing with call_func() would be able to catch most of the errors that the parser's multiple assignment scanner would. Hmm.
If desequencing were just the same as multiple assignment then yes, but it's not.
I take it for granted that in desequencing (playing with sequences) this remains perfectly valid
p = {1,2,3} {i,j} = p
However, with multiple assignments (function results)
{i,j} = call_func(...) -- (oi, there be 3 values there, mate) p = call_func(...) -- (oi, where's me multiple assignment)
Then whether it is desequencing (as above) or the semantically different multiple assignment (function results) must be dynamically determined; whether the routine being invoked contains a return 1,2,3 or a return {1,2,3} has to be known at run-time to determine whether it is an error or not. That is the bit I am calling an awful lot of work for very little gain.
Pete