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

Re: Declarations

    Date: 21 Jul 86 14:34:00 EST
    From: "BACH::GREEK" <greek%bach.decnet@hudson.dec.com>
    To: "common-lisp" <common-lisp@su-ai.ARPA>
    Subject: Declarations
    I hadn't read Nick's clarification to Pavel's proposal before I sent
    out my last message.  Nick's clarification looks quite good.
    A question:  Why did you choose to say that declarations pertaining
    to names that are not bound in the current contour affects references
    in the entire form?  Why not just in the body of the form?

I felt that decls pertaining to names not bound in the current
contour were analogous to the optimize decl which never pertains to
names.  If I have a tight loop that I want to go fast, I write
(do ((rest list (rest rest)))
    ((endp rest...)
    (declare (optimize (speed 3) (safety 0)))
And I expect the optimize to affect the step forms and the end
test in addition to the actual body.  If OPTIMIZE affected only the
'simple body', I'd have to write
(do ((rest list (locally (declare (optimize...)) (rest rest))))
    ((locally (declare (optimize...)) (endp rest))...)
    (declare (optimize (speed 3) (safety 0)))
I think the same argument holds, for example, for INLINE.  If I want
to open-code all calls to some accessor function in a do loop, where
some of the calls to the accessor function are in the step forms, I
don't want to use LOCALLY all over the place.

One can think up similar arguments for FLET, etc.

    I'm not sure I know which is better, I'm just wondering how you
    - Paul