Re: Feedback on enhancement request
- Posted by tone.skoda at siol.net Feb 15, 2002
- 499 views
That is common problem also to me. To do it like this: fred_result = fred() meaningful_name = fred_result [1] if meaningful_name = ... then is better than like this: seq = fred() if seq [1] = ... then Selecting the right names for your variables in very important for readable code. Maybe the most important part in writing readable code and also a difficult one sometimes. But I find your source code of your libraries very good and clear. ----- Original Message ----- From: "Ray Smith" <smithr at ix.net.au> To: "EUforum" <EUforum at topica.com> Sent: Saturday, February 16, 2002 4:29 AM Subject: Feedback on enhancement request > > Hi, > > I propose that a function can "return" multiple distinct values. > > eg. > > function fred(...) > integer return_code > sequence result > > ... > > return {ret}, {result} > end function > > > integer a > sequence b > > a , b = fred(...) > > I find I often want to return two or more distinct values back from > function. I find it messy and difficult to re-read code after some > months that is like: > > seq = fred() > if seq[1] = ... then > ...do soemthing witg seq[2] ... > > Would this also remove the need for pass by reference? > > As an example > > ------ > function swap(atom a, atom b) > return {b}, {a} > end function > > variable1, variable2 = swap(variable1, variable2) > ------- > > Anyone have any thoughts? > > > Ray Smith > http://www.geocities.com/ray_223 > > > >