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

DYNAMIC-EXTENT



I don't see any way in the proposal to declare that a closure itself, rather than
its arguments, has dynamic extent.  My greatest single use for dynamic-extent
declarations is to ensure stack-consing of closures.

Symbolics have a declaration SYS:DOWNWARD-FUNCTION for this case.
Perhaps CL could use DYNAMIC-EXTENT-FUNCTION

(flet ((test (a b)
         (declare (dynamic-extent-function))
         ...))
  (foo #'test))

(foo (lambda (a b)
       (declare (dynamic-extent-function))
       ...))



Another feature which I find sorely needed (and which nobody seems
to support) is a way to declare that the result of a form
has dynamic extent.  For example,
  (defmacro with-frob (thunk &body body)
    `(let ((*frob-stack* (cons (the dynamic-extent-object ,thunk) *frob-stack*)))
       (declare (dynamic-extent *frob-stack*))
       ,@body))
The idea is to avoid making all users of the with-frob macro
put in explicit dynamic-extent-function declarations.