Re: Multiple return values

jbuck@Synopsys.COM (Joe Buck)
18 Apr 1997 01:09:09 -0400

          From comp.compilers

Related articles
[2 earlier articles]
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)
Re: Multiple return values hrubin@stat.purdue.edu (1997-04-20)
Re: Multiple return values fjh@mundook.cs.mu.OZ.AU (1997-04-22)
[21 later articles]
| List of all articles for this month |
From: jbuck@Synopsys.COM (Joe Buck)
Newsgroups: comp.compilers,comp.lang.misc
Date: 18 Apr 1997 01:09:09 -0400
Organization: Synopsys Inc., Mountain View, CA 94043-4033
References: 97-04-091
Keywords: design

Arthur.Chance@Smallworld.co.uk (Arthur Chance) writes:
>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?


More languages require multiple return values than you may think,
since any language that permits a function to return a value of record
("struct" in C/C++) type can be considered to return multiple values
(the elements of the record). It is true that these languages often
make it clumsy to do this (the programmer has to write code to pack
and unpack the values in the record), and languages are often too
insistent on treating records as having a definite layout in memory.


Note that the C++ Standard Template Library contains the pair template
(representing a pair of objects of arbitrary type) and uses it to
implement functions that return two values.
--
-- Joe Buck http://www.synopsys.com/pubs/research/people/jbuck.html
--


Post a followup to this message

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