From: Darren New <dnew@san.rr.com>
Subject: Re: Out parameters in a function
Date: Wed, 17 Apr 2002 16:15:48 GMT
Date: 2002-04-17T16:15:48+00:00 [thread overview]
Message-ID: <3CBD9FD8.D246C187@san.rr.com> (raw)
In-Reply-To: 9728d398ea882f2a2d44e362db453fe9.48257@mygate.mailgate.org
Kent Paul Dolan wrote:
>
> "Darren New" <dnew@san.rr.com> wrote:
>
> > > > RESULT high, low
> > > h, l := split.int16 (365)
>
> > Note that in virtually all these languages, what this means is "return
> > an anonymous tuple from the function." AFAIK, FORTH is the only
> > reasonably common language where you can *actually* return multiple
> > values from a function, rather than returning a single structured value.
>
> Ummm. APL, PL/PGSQL, CLAIRE, ML (and so OCaml, JoCaml), ...
APL returns one value, which might be an array. SQL returns one value
which might be a table. I don't know CLAIRE. ML (if I understand it
correctly) returns one value, which is a tuple or list or scalar. Python
returns a tuple of values, or an object with slots, or whatever.
FORTH, on the other hand, allows for the equivalent of
being
do some computations
return the first value
do more computations
return the second value
do more computations
if some condition holds
return a third value
end
Altho the syntax of the other languages make it pretty much as
convenient and efficient to return a single tuple/array/whatever and
treat it as an entire list.
If you actually compare it with the difference in Ada between out
parameters and multiple return values, I think you'll see why FORTH is
different from (my understanding of) these other languages, where said
languages are strongly typed. I don't think occam would allow you to
declare a function that returns either a string, or two integers, or an
array of floats, depending on the arguments, yes?
--
Darren New
San Diego, CA, USA (PST). Cryptokeys on demand.
The 90/10 rule of toothpaste: the last 10% of
the tube lasts as long as the first 90%.
next prev parent reply other threads:[~2002-04-17 16:15 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-14 18:29 Out parameters in a function Nazgul
2002-04-14 19:45 ` David C. Hoos, Sr.
2002-04-15 10:49 ` John McCabe
2002-04-15 11:51 ` John McCabe
2002-04-15 13:43 ` Steve Doiel
2002-04-15 15:09 ` Ted Dennison
2002-04-16 8:49 ` John McCabe
2002-04-16 10:05 ` Dmitry A. Kazakov
2002-04-16 15:26 ` John McCabe
2002-04-16 19:34 ` Matthew Woodcraft
2002-04-16 20:10 ` Darren New
2002-04-17 1:30 ` Kent Paul Dolan
2002-04-17 16:15 ` Darren New [this message]
2002-04-19 17:39 ` Florian Weimer
2002-04-17 13:24 ` Stephen Leake
2002-04-17 16:32 ` Darren New
2002-04-17 21:03 ` Kent Paul Dolan
2002-04-18 12:14 ` Wolfgang Gellerich
2002-04-18 13:52 ` Dmitry A. Kazakov
2002-04-18 16:28 ` Darren New
2002-04-17 10:17 ` John McCabe
2002-04-16 19:58 ` Kent Paul Dolan
2002-04-16 20:00 ` Kent Paul Dolan
2002-04-17 4:40 ` Jim Rogers
2002-04-17 5:27 ` Kent Paul Dolan
2002-04-17 5:50 ` Eric G. Miller
2002-04-24 2:45 ` David Thompson
2002-04-19 17:40 ` Florian Weimer
2002-04-19 18:26 ` Jim Rogers
2002-04-19 18:53 ` Florian Weimer
2002-04-17 7:57 ` Dmitry A. Kazakov
2002-04-17 10:21 ` John McCabe
2002-04-24 17:21 ` Warren W. Gay VE3WWG
2002-04-26 7:32 ` Dmitry A. Kazakov
2002-04-15 16:24 ` Stephen Leake
2002-04-16 13:38 ` Ted Dennison
2002-04-17 11:55 ` Ingo Marks
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox