Re: Pass by Reference
- Posted by petelomax Jan 14, 2015
- 2057 views
dcuny said...
But my assumption is that a routine should return a fixed number of parameters.
... RIGHT ... then you and I have very different views!
As a quick example, get_operand() can return:
- P_REG, size, 1..8|16
- P_VAR, size, N, type
- P_MEM, size, scale, index, base, offset
- P_LBL, lblidx
- P_IMM, atom
And you can pass (a combination of) those P_XXX as permitted types to get_operand(), so (sometimes) you know what you'll get back.
Admittedly, in practice, I use dummy sizes of 0, but also nested subsequences, for which your plain comma syntax could never work.
So, finally, it's a "noo, I'm out" from me.
Pete
PS: In Phix, you can say {a,b[1],{c[2..3],{d,?,e[4]}}} = f() no problem, if you want to. Pick a compile-time error out of that.