Re: Multiple return values

marssaxman < (Mars Saxman) marssaxman%sprynet.com.antispam@nac.no>
18 Apr 1997 01:06:21 -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)
Re: Multiple return values smcadams@sprynet.com (steve mcadams) (1997-04-20)
Re: Multiple return values tiggr@es.ele.tue.nl (1997-04-20)
[23 later articles]
| List of all articles for this month |
From: marssaxman < (Mars Saxman) marssaxman%sprynet.com.antispam@nac.no>
Newsgroups: comp.compilers,comp.lang.misc
Date: 18 Apr 1997 01:06:21 -0400
Organization: Red Planet Software
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?


I think it is an artefact of the origin of the "function" concept. The
idea of a function in maths is that you give it some parameters and it
performs some calculation on them. The result of the calculation is
the return value. It doesn't make sense to have, for example, an
arctangent return more than one value. Given the origins of computing
in maths it is easy to see why this habit has been carried on.


Incidentally, I've been working with an experimental language "Sierra"
which allows multiple inputs and outputs:


define foo =
    (
    in {x, y, z} = integer32
    out {a, b} = boolean16
    ...
    )


The function can still be used in an expression; the idea is that the
parameter list and return values are implicit record structures, so the
expression value can be placed into any variable whose structure matches
the returned values.


-Mars
--


Post a followup to this message

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