Re: Multiple return values

hbaker@netcom.com (Henry Baker)
18 Apr 1997 00:45:44 -0400

          From comp.compilers

Related articles
Multiple return values Arthur.Chance@Smallworld.co.uk (1997-04-16)
Re: Multiple return values WStreett@shell.monmouth.com.spamguard (1997-04-18)
Re: Multiple return values smryan@mail.com (1997-04-18)
Re: Multiple return values icedancer@ibm.net (1997-04-18)
Re: Multiple return values hbaker@netcom.com (1997-04-18)
Re: Multiple return values fjh@mundook.cs.mu.OZ.AU (1997-04-18)
Re: Multiple return values (Mars Saxman) marssaxman%sprynet.com.antispam@nac (marssaxman) (1997-04-18)
Re: Multiple return values preston@tera.com (1997-04-18)
Re: Multiple return values jbuck@Synopsys.COM (1997-04-18)
Re: Multiple return values smryan@mail.com (1997-04-20)
Re: Multiple return values danwang@dynamic.CS.Princeton.EDU (1997-04-20)
[25 later articles]
| List of all articles for this month |

From: hbaker@netcom.com (Henry Baker)
Newsgroups: comp.compilers,comp.lang.misc
Date: 18 Apr 1997 00:45:44 -0400
Organization: nil
References: 97-04-091
Keywords: design

Arthur.Chance@Smallworld.co.uk (Arthur Chance) wrote:


> A thought struck me over the weekend while rereading the "Lambda: the
> Ultimate <foo>" papers:
>
> 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?


Clumsy syntax, mostly, and almost total ignorance of CPS by non-Lisp
people.


Carl Hewitt was probably the biggest promotor of CPS back in the early
1970's, and the Scheme people (Sussman, Steele) took up the cry.
There is (at least) one issue of Lisp & Symbolic Computation devoted
to CPS and its history.


The stack-based languages (Forth, Postscript) have always had symmetry
in multiple arguments and multiple returned values. These languages
typically have 2 (or more) stacks, so that the return points don't
have to be synchronized to the arguments and returned values. This
provides for a relatively cheap solution for 'tail calling' (lambda
calculus axiom eta).


Some languages provide for multiple arguments by currying, while
others provide for multiple arguments by virtually consing them into a
list or a vector (or both!). Most languages allow multiple returned
values in the form of a consed up list or vector, but the efficient
implementation of this can require a _huge_ amount of sophistication
and is therefore not usually done.
--


Post a followup to this message

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