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

issue DYNAMIC-EXTENT-FUNCTION, version 1



re:   Introduce a new declaration called DYNAMIC-EXTENT-FUNCTION.  This is
      identical to the DYNAMIC-EXTENT declaration, except that the
      arguments name functions instead of variables.

This is not sufficiently clear for a "specification".  I think you should
at least talk about how the DYNAMIC-EXTENT-FUNCTION declaration only applies 
to lexical functions defined via FLET and LABELS, and is not to be used in
a proclamation.  

Additionally, you will have to say, for a form like:

    (locally (declare (dynamic-extent-function f g))
      (labels ((f (x) ...)
               (g (y) ...)
               (h (z) ...))
	(declare <more-declarations>)
       ...))

whether or not the declaration in the LOCALLY is to apply to the two
functions, or whether it has to be supplied in the place indicated by
<more-declarations>  [my first inclination is that it doesn't apply,
since similar program structure for type declarations wouldn't apply.]

Similarly, you will have to say whether or not there is such a thing
as a "free"  dynamic-extent-function  declaration.  E.g., what does
the following mean:

    (flet ((f (x) ...))
      (funcall f gobbledygook)
      (locally (declare (dynamic-extent-function f))
        (cogitate #'f))
      t)

Here, my inclination is that unless the dynamic-extent-function declaration
is applied to the name binding, it is useless to the compiler.  It's a bit
like allowing the compiler to represent FLOATs in specialized storage,
providing it knows that during the entire lifetime of the variable -- 
including the binding time -- the value will only be FLOAT [hence, it can, 
e.g., use the flonum pdl instead of "boxing up" the value in the heap]

Finally, you have to say how you handle a case like:

    (mapcar (the dynamic-extent-function #'(lambda (x) <capture-stuff>))
            ...)

and if so, how to specify the particular dynamic scope of interest.
Or, maybe you don't want to handle "anonymous" lexical functions. [By
the bye, I realize that 'dynamic-extent-function' isn't a type -- I
only wanted to illustrate the problem for "anonymous" functions.]


If the places where the two declarations DYNAMIC-EXTENT-FUNCTION and
DYNAMIC-EXTENT can be legitimately used don't overlap, then I don't 
see anything wrong with using the same name.  E.g.,

   (let ((x (make-list n :initial-element 0)))
     (declare (dynamic-extent x))
     (labels ((f (y z) ...))
       (declare (dynamic-extent f))
       . . . ))

should be unambiguous.



-- JonL --



P.S. The fact that I'm replying to a msg sent today doesn't mean that
     I'm not still 4 weeks behind (in general) in mail reading.