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

Re: issue DYNAMIC-EXTENT-FUNCTION, version 1



> Date: Fri, 26 May 89 12:22 EDT
> From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
> 
> That
> shows something interesting about the Symbolics sys:downward-function
> declaration: the scope that defines the dynamic extent is larger than
> the lambda-expression containing the declaration.

That's the main reason why I'm not really enthusiastic about this
approach -- the scoping rules just don't fit in with the rules for
other declarations.

> I guess you're going to require that
>   (funcall <foo> (lambda (...) (declare (sys:downward-function)) ...))
> be restructured as
>   (flet ((dummy (...) ...))
>     (declare (dynamic-extent #'dummy))
>     (funcall <foo> #'dummy))

Yes, this is what I had in mind.  Sorry if that wasn't clear in my 
original message.  I agree that the syntax is rather cumbersome.

> After all, in this example
>   (let ((a <foo>))
>     (declare (dynamic-extent a))
>     (<bar> #'(lambda (z) (if (<baz> z) (<frob> a) (<borf> z)))))
> the dynamic extent declaration for A might mean that by the time the
> scope of the declaration is exited, something will happen that will
> make <baz> return false from then on, so A will no longer be referenced,
> even though the closure that was given as an argument to <bar> will
> continue to be called.

I guess we differ over what "referenced" means.  My interpretation is
that the closure references A regardless of whether or not the piece
of code which references A inside the closure is actually executed on
any particular invocation, and that it's therefore an error to say
that A has dynamic extent unless the closure also has dynamic extent. 

Maybe the real problem is that the DYNAMIC-EXTENT proposal didn't
formally define what "inaccessible" means.  I'm relying on an
intuitive idea of what parts of a closure a garbage collector would
have to scan.

-Sandra
-------