[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what does (declare (downward-function)) do?
- To: engber@aristotle.ils.nwu.edu (Mike Engber)
- Subject: Re: what does (declare (downward-function)) do?
- From: Gary Byers <gb>
- Date: Wed, 21 Aug 91 15:37:53 EDT
- Cc: info-mcl@cambridge.apple.com
- In-reply-to: <9108211859.AA28510@aristotle.ils.nwu.edu>; from "Mike Engber" at Aug 21, 91 1:59 pm
>
> The subject line says it all. I see no mention in Steele.
> I assume it allows for some optimization.
> -ME
>
It becomes extinct or obsolete.
It was intended as a way of advertising that an anonymous lexical closure
had dynamic extent; the effect was to treat:
(foo #'(lambda (x y) (declare (downward-function)) ...) ...)
as if it were:
(flet ((#:g1 (x y) ...))
(declare (dynamic-extent #'#:g1))
(foo #'#:g1 ...))
i.e., as if the closure's extent "wrapped around" the nearest surrounding
function call.
Aside from being syntactically obscure, the semantics are sometimes a bit
surprising, as in cases like:
(foo (identity #'(lambda (x y) (declare (downward-function)) ...)) ...)
Whoops.
Using some binding form and a DYNAMIC-EXTENT declaration seems preferable;
although one may have to expend some effort in thinking up a name to bind the
function to, one is at least making it clear just which extent it is that's
dynamic ...