[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
multiple-value return
- To: common-lisp@su-ai
- Subject: multiple-value return
- From: Kim.fateman@Berkeley
- Date: Sun, 14 Nov 1982 01:33:00 -0000
It seems to me that the costs associated with doing this right can be
absorbed as Moon suggests, in microcode, but I am not convinced that the
costs can be easily borne in conventional machines. Ordinarily a receiver
of a value will not know whether it must extract the first item in a multiple
value, or just use the non-multiple-value as given, unless some check
is performed.
What is the point of all this? I see two points: one: a minor convenience
for functions like divide (returning quotient and remainder), and its ilk
[its ilk growing extremely rapidly when hackers realize they can do this
free]; two: an important feature of a lisp where conses must be avoided.
Lisp Machines, esp. without garbage collectors, presumably benefit from the
avoidance of conses. Lisps which must serve as system programming
languages (instead of using, say, C, which deals with call-by-reference
by the obvious kind of mechanism), is another possibility.
Let us turn the table a bit. I believe that if conses/gc were really cheap,
there would be much less benefit to m-v-r.
e.g. divide could just return (quotient . remainder), other objects could
be cons'd up (or put in vectors ...). Now on conventional computers,
conses and gcs may not actually be so cheap, but if m-v-r is expensive,
perhaps conses WOULD be more acceptable?
The constant overhead looking
for m-v-r in, for example, macsyma, which does not, at the moment,
use m-v-r even once, would be distasteful.
If m-v-r is free, of course, I suppose that's fine. If it is not free,
perhaps it should be flushed from Common Lisp.