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

DYNAMIC-EXTENT



    Date: Fri, 17 Mar 89 15:21:24 EST
    From: Guy Steele <gls@think.com>

    This is a genuine need.  I suggest

    (flet ((test (a b) ...))
      (declare (dynamic-fextent test))	;So pick a better name
      (foo #'test))


A declaration in the body of the function feels preferable to me
as a user -- otherwise it is necessary to create a name for a function
simply to declare something about it.  There may indeed be semantic
reasons to decide otherwise.

       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.

    This proposal has problems.  It is not enough to say
    "foo has dynamic extent extent".  [...]

Forget it.  I was confused (probably by the fact that I use a lisp
implementation which has a dynamic-extent declaration within closures
but no general dynamic-extent declaration in the sense of the proposal.)

I should have written my sample macro as
(defmacro with-frob (thunk &body body)
  (let ((tem (gensym)))
    `(let ((,tem ,thunk))
       (declare (dynamic-extent ,tem))
       (let ((*frob-stack* (cons ,tem *frob-stack*)))
         ...))))
where I assume that the implementation knows to stack-allocate the `y' in
(let* ((foo 1)
       (y (lambda () foo)))
  (declare (dynamic-extent y))
  ... y ...)