From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11232c,bde6489d2ec79329 X-Google-Attributes: gid11232c,public X-Google-Thread: 103376,9245b8db9abd376c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-17 09:16:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.rdc-nyc.rr.com!news-east.rr.com!cyclone.kc.rr.com!news.kc.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!twister.socal.rr.com.POSTED!not-for-mail Message-ID: <3CBD9FD8.D246C187@san.rr.com> From: Darren New X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada,misc.misc Subject: Re: Out parameters in a function References: <3cbbe583.3628858@news.demon.co.uk> <3cbc3f05.26543327@news.demon.co.uk> <3CBC855D.148232E3@san.rr.com> <9728d398ea882f2a2d44e362db453fe9.48257@mygate.mailgate.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 17 Apr 2002 16:15:48 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1019060148 66.75.151.160 (Wed, 17 Apr 2002 09:15:48 PDT) NNTP-Posting-Date: Wed, 17 Apr 2002 09:15:48 PDT Organization: RoadRunner - West Xref: archiver1.google.com comp.lang.ada:22661 misc.misc:6454 Date: 2002-04-17T16:15:48+00:00 List-Id: Kent Paul Dolan wrote: > > "Darren New" 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%.