[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MULTIPLE-VALUE-OR, and Consing
Date: Sat, 18 Apr 87 19:34 EDT
From: MURRAY%cs.umass.edu@RELAY.CS.NET
>I think more to the heart of the matter is that Common LISP needs a way to grab,
>inspect, and pass on an unknown number of multiple values without consing
> (and yes, avoiding consing can be crucial for real applications
> give the current state of the art for garbage collection
> on conventional hardware). It's possible that, using
>multiple-value-call, simply having some way of
>doing non-consing &rest arguments may be sufficient. ...
I whole-heartly agree that A) Unneccessary consing should always be avoided,
B) it would be great to have &rest args that don't cons.
I currently have plans to have a STACK-LIST declaration that declares that
a &Rest is stack-allocated (as well as WITH-STACK-LIST, ala Lisp Machines)
in my system. I would suggest that others consider this as well, but
of course, it is only a declaration that could be ignored.
(I already avoid consing for (&Rest ignore), which should be easy).
My point is that MULTIPLE-VALUE-OR can only be done efficiently by low-level
implementation-specific code, and thats why it should be in Common Lisp.
I don't think this conclusion follows from your previous paragraph.
If the proposed MULTIPLE-VALUE-OR can easily be implemented in terms of
existing primitives, such as MULTIPLE-VALUE-CALL, and would be efficient
if there were non-consing &rest arguments, and non-consing &rest arguments
are desirable for other reasons, then I think a more logical conclusion is
"because non-consing &rest arguments can only be done efficiently by low-level
implementation-specific code, they should be in Common Lisp."
By the way, I don't think a declaration for non-consing &rest arguments
should be necessary. It should be simple enough for any compiler to
recognize special cases such as the following, once implementors'
attention has been drawn to the desirability of such optimizations. Another
way of saying the same thing is that I think consing is an implementation
issue, not a language issue, just as much as whether integer multiplication
takes 1 microsecond or 10 microseconds.
(lambda (&rest values)
(when (first values)
(return-from block (values-list values))))