Re: Multiple return values

John Haxby <jch@hazel.pwd.hp.com>
4 May 1997 00:23:12 -0400

          From comp.compilers

Related articles
[15 earlier articles]
Re: Multiple return values roy@earthlight.co.nz (1997-04-22)
Re: Multiple return values Robert.Harley@inria.fr (1997-04-22)
Re: Multiple return values jashley@eecs.ukans.edu (Mike Ashley) (1997-04-22)
Re: Multiple return values burley@tweedledumb.cygnus.com (Craig Burley) (1997-04-22)
Re: Multiple return values albaugh@agames.com (1997-04-22)
Re: Multiple return values tiggr@es.ele.tue.nl (1997-04-30)
Re: Multiple return values jch@hazel.pwd.hp.com (John Haxby) (1997-05-04)
Re: Multiple return values jan@digicomp.com (Jan Galkowski) (1997-05-04)
Re: Multiple return values gscase@interact.net.au (1997-05-04)
Re: Multiple return values Robert.Harley@inria.fr (1997-05-04)
Re: Multiple return values tim@franck.Princeton.EDU (1997-05-04)
Re: Multiple return values jens.hansson@mailbox.swipnet.se (1997-05-04)
Re: Multiple return values jamesl@netcom.com (1997-05-08)
[8 later articles]
| List of all articles for this month |
From: John Haxby <jch@hazel.pwd.hp.com>
Newsgroups: comp.compilers,comp.lang.misc
Date: 4 May 1997 00:23:12 -0400
Organization: Hewlett-Packard
References: 97-04-091
Keywords: design

Arthur Chance wrote:
> Most programming languages allow procedures with multiple arguments
> (in some cases allowing them to be used in curried form as well), but
> very few languages allow multiple return values, in spite of the fact
> that multiple results *are* multiple arguments when you're wearing
> CPS-tinted glasses. Why is this?


CLU has multiple return values -- more by necessity than convenience
because CLU doesn't really have a pointer type. So you can do


r, theta := rect2polar (x, y)


for example. You can also do


if x < y then
x, y := y, x
end


though this is slightly less useful than you might imagine since


if x[i] < y[i] then
x[i], y[i] := y[i], x[i]
end


because you can't have procedure calls on the left hand side of an
assignment (functions can't return references to objects and x[i] is
syntactic sugar for T$get(x, i))


--
John Haxby
jch@pwd.hp.com http://www.ice.hp.com/
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.