Related articles |
---|
[22 earlier articles] |
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) |
Re: Multiple return values mark@omnifest.uwm.edu (1997-05-13) |
Re: Multiple return values bear@sonic.net (Ray Dillinger) (1997-05-13) |
Re: Multiple return values jan@fsnif.neuroinformatik.ruhr-uni-bochum.de (Jan Vorbrueggen) (1997-05-14) |
Re: Multiple return values hbaker@netcom.com (1997-05-14) |
Re: Multiple return values markt@harlequin.co.uk (Mark Tillotson) (1997-05-25) |
Re: Multiple return values hbaker@netcom.com (1997-05-25) |
[1 later articles] |
From: | hbaker@netcom.com (Henry Baker) |
Newsgroups: | comp.compilers,comp.lang.misc |
Date: | 8 May 1997 21:08:52 -0400 |
Organization: | nil |
References: | 97-04-091 97-04-112 97-04-135 97-05-045 |
Keywords: | design, performance |
Pieter Schoenmakers <tiggr@es.ele.tue.nl> wrote:
>What about a function R x R -> R x R?
tim@franck.Princeton.EDU (Tim Hollebeek) wrote:
> Most mathematicians would contend that this returns a single value,
> and that value is an ordered pair of real numbers. Of course,
> multiple arguments are just a convenience anyway; one could do just
> fine talking about f((a,b,c)) instead of f(a,b,c). The situation is
> really symmetric wrt inputs and outputs (especially for relations of
> which functions are just a special case); it is the typical
> mathematical and PL notation that makes them look different.
From an implementation point of view, there are two critical properties
of the multiple value that is just 'an ordered pair' (or tuple):
* it is a _read-only_ pair (or tuple), which means that you don't have to
supply it with an 'object identity' (address/pointer); and
* it is received by exactly one receiver and then discarded (linear/unique
property)
Knowing these two properties allows for an extraordinarily efficient
implementation of multiple return values. If you try to emulate
multiple return values using 'heavier' objects --- those with object
identity and reference counts >1 --- then prepare yourself for a very
slow implementation.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.