Re: Feedback on enhancement request
- Posted by petelomax at blueyonder.co.uk Feb 16, 2002
- 497 views
On Sat, 16 Feb 2002 03:29:22 +0000, you wrote: >I find I often want to return two or more distinct values back from >function. It's the multiple assign which is hard. If you could write {a,b}=swap(b,a) or massign({a,b},swap(b,a)) then return doesn't need to change. But multiple assign is horrible, like the sudden English "or" separating the Euphoria code above. Quickly, what's edge set to in: {girth,widths,height,uplift,edge,jut,throw}={3,{7,6,5,2},89,2,{3,4,2},9,{3,4}} OK, so you might know that fairly easily,or not, but you've just read the line of code, so without looking, what was height just set to? For something minimalist like swap you just really want a <=> operator, there is no better way to make it nice&sweet&short. For anything more complicated, though temp=func(a,b) a=temp[1] b=temp[2] is justified. I use it alot and it's not so bad if you do that rather than have [1] & [2] litter the following code. Othertimes I enumerate, eg constant COUNT=1, AVERAGE=2 then if result[COUNT]> threshold then ... x=result[AVERAGE]*result[COUNT] Pete