Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!purdue!i.cc.purdue.edu!k.cc.purdue.edu!l.cc.purdue.edu!cik From: cik@l.cc.purdue.edu (Herman Rubin) Newsgroups: comp.lang.misc Subject: Re: multiple values Message-ID: <734@l.cc.purdue.edu> Date: 30 Mar 88 17:43:55 GMT References: <12176@brl-adm.ARPA> <1988Mar11.215238.976@utzoo.uucp> <3213@haddock.ISC.COM> Organization: Purdue University Statistics Department Lines: 31 Summary: But how should it be done In article <3213@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: > In article <727@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes: > >In article <3177@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: > So? The way I wrote it, q and r are never more than unnamed virtual objects. > I'm looking for a syntax that allows all three (qr, q, r) to disappear, if > all I really want is an expression that returns q*q+r*r. If we allow 2-d > notation, this could be written This shows that flexibility and non-portability are needed. If the quotient and remainder are not simultaneouly generated, then the choice between the order of computation is quite great, while if the hardware simultaneously can generate them, and registers can hold the information, the pair (q,r) as a real object should exist for the purpose of reasonable efficiency. In the case where the programmer or compiler wishes to use that capability of the hardware, it is necessary to have an object which I call a list. Namely, the operation returns more than one value, and there is no necessary relation between the locations of the various objects. If the hardware insists in putting the quotient and remainder in adjacent registers, this in no way complicates matters. Typically, the user will allow an optimizing compiler to take these things into account. If the compiler is not sufficiently optimizing, the user will have to edit the compiler's output. But the language which does not have lists is unlikely to be able to act reasonably if they are useful. inter -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (ARPA or UUCP) or hrubin@purccvm.bitnet