Feedback on enhancement request

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu