Re: Multiple return values

Jan Galkowski <jan@digicomp.com>
4 May 1997 22:03:30 -0400

          From comp.compilers

Related articles
[16 earlier articles]
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)
Re: Multiple return values hbaker@netcom.com (1997-05-08)
[7 later articles]
| List of all articles for this month |
From: Jan Galkowski <jan@digicomp.com>
Newsgroups: comp.compilers,comp.lang.misc
Date: 4 May 1997 22:03:30 -0400
Organization: Digicomp Research Corporation
References: 97-04-091 97-04-112 97-04-146
Keywords: design, semantics

Roy Ward wrote:


> That, and multiple values are generally more difficult to deal with
> (both in the specification of the langauage, and implementation). You
> are forced to effectively bundle the return values into some sort of
> structure, or have the whole architecture of the language structured
> to deal with this (adding results to lists).
>
> However, on the plus side, I think that multiple returns are a useful
> concept in functional languages where functions are only allowed to
> return results, as having to set up a structure for each time there
> might be more than one thing to return, and then pull bits out of the
> structure in the calling function, is a little painful.


Of course, you can handle multiple returns using coroutines, and the
means of implementing these in languages like C or C++ is
well-known. (See, e.g., D.E. Knuth, THE ART OF COMPUTER PROGRAMMING,
volume 1, "Fundamental Algorithms", Section 1.4.2, 1975.) And some
languages, such as <A
HREF="http://www.cs.arizona.edu/icon/www/">Icon</A>, provide an
implicit mechanism for coroutines and generators.


--
  Jan Theodore Galkowski,
  developer, statistician,
      Digicomp Research Corporation,
      Ithaca, NY 14850-5720
  jan@digicomp.com
  (also jtgalkowski@worldnet.att.net)
--


Post a followup to this message

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