|[27 earlier articles]|
|Re: Multiple return values firstname.lastname@example.org (1997-05-08)|
|Re: Multiple return values email@example.com (1997-05-08)|
|Re: Multiple return values firstname.lastname@example.org (1997-05-13)|
|Re: Multiple return values email@example.com (Ray Dillinger) (1997-05-13)|
|Re: Multiple return values firstname.lastname@example.org (Jan Vorbrueggen) (1997-05-14)|
|Re: Multiple return values email@example.com (1997-05-14)|
|Re: Multiple return values firstname.lastname@example.org (Mark Tillotson) (1997-05-25)|
|Re: Multiple return values email@example.com (1997-05-25)|
|Re: Multiple return values firstname.lastname@example.org (1997-05-30)|
|From:||Mark Tillotson <email@example.com>|
|Date:||25 May 1997 12:44:37 -0400|
|Organization:||Harlequin Ltd, Longstanton House, Cambridge UK|
marssaxman < (Mars Saxman) firstname.lastname@example.org> wrote:
> 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.
Huh? Mathematically a function is simply a many-1 binary relation
defined for the whole of its domain. Any talk of more than one
argument is shorthand for using cartesian products, which you can do
with the result just as easily. In fact functions really don't have
anything to do with calculation!!
Conceptually there should be no difference between passing arguments
and passing results, because a value is being passed, and hopefully
the type passed is a subtype of the value expected. Multiple args and
results are shorthand for cartesian products.
I suspect that the reason languages quickly adopted multiple args yet
retained single results is both the prior use of shorthand convention
in maths, and because that in order to live with a world where
functions take a "single argument" you either need an explicit
cartesian product operation, which itself is written as a function of
more than one argument, or you need to support higher-order functions,
which implies implementing closures and using garbage collection.
The implementors of Fortran didn't, it seems, want to implement
closures and curried functions, and set a(n) historical precedent.
[ email@example.com | http://www.harlequin.co.uk/ | +44(0)1954 785433 ]
[I suspect that Fortran allowed multi-argument functions because they wanted
to put two-argument arctangent in the library. -John]
Return to the
Search the comp.compilers archives again.