[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stack-consed &REST args?



Thanks to all who answered my earlier question about who-calls.  The
MCL FTP site contains several who-calls implementations, and one of
these is included in the examples directory of the MCL release.

Next question: I was unable to find anywhere in the MCL 2.0
documentation, or the FAQ, any reference to the DYNAMIC-EXTENT
declaration, and particularly the use of this declaration on &REST
arguments of functions.  Several other CL implementations support this
idiom by stack-consing &REST args for such functions.  Does MCL?  If
not by default, is there a patch or hack available to add this
support?

E.g. in the example below:

(define foo (&rest nums)
  (declare (dynamic-extent nums))
  (reduce #'+ nums))

A compiler supporting this idiom would allocate the list of actual
arguments on the call stack, where it would automatically disappear
when FOO returned.  The default behavior per CLtL[12] and X3J13 is to
allocate the parameter list on the heap, where it must be GC'd later.

Again, thanks in advance.
 -- Chuck, still learning MCL, but learning to appreciate it
--
 Chuck Fry  Work: chucko@ptolemy.arc.nasa.gov  Play: chucko@rahul.net
	I alone am responsible for the contents of this post.
	    Keep NASA and RECOM Technologies out of this.