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


> I like this new version of SYNTACTIC-ENVIRONMENT-ACCESS:SMALL,
> except for two minor comments:
>  DECLARATION retrieve information about declarations that are in
>  effect in the environment.  Since implementations are permitted to
>  ignore declarations (except for SPECIAL declarations), these accessors
>  are required only to return information about declarations that were
>  explicitly added to the environment using AUGMENT-ENVIRONMENT.
> I think this is wrong.  Certainly if DECLARATION is to be useful
> implementations must not be allowed to discard any of the declarations
> it can return.  As someone from an implementation that ignores type
> declarations, I can say that I think all implementations should be
> required to return all declarations from all three of these functions.
> I think implementations should be permitted to ignore declarations
> in the sense of the code generated by the compiler not being affected
> by declarations, but should not be permitted to just throw declarations
> away rather than putting them into the syntactic environment.

I think there is a fundamental question here of what the purpose of the
proposal is -- is it to 

(1) Allow users to gain access to certain information in the compiler's
    data structures


(2) Require the compiler to do some extra bookkeeping for the user.

I have been assuming purpose (1), while you seem to be assuming purpose

The only declarations that can be discarded are those which don't change
the semantics of the program.  Thus, a macro expander might like to know
what the type of a variable is, or what the OPTIMIZE levels are, but
neither is necessary for it to produce correct code.  If someone adds a
bunch of type declarations to their source in order to make the compiled
code faster, would they expect that this would make it run slower when
evaluated?  I don't like the idea of forcing the evaluator to remember a
lot of information that it has no use for just in case someone might
possibly ask to see it later.

What you want sounds like the way the special variable LOCAL-DECLARATIONS
was used in the Zetalisp compiler -- all declarations were simply pushed
on the list and anyone could access the variable to look up whatever they
were interested in.  This has proven to be very inefficient; everything
that our compiler really cares about is now stored some other way.  The
only declarations that we push on LOCAL-DECLARATIONS now are those that
are in a list of declarations that need to be treated that way; this was
just in case some users needed that capability, but I have never seen any
program that did use it.  I really don't want to standardize something
like LOCAL-DECLARATIONS unless there are real uses for it, not just
hypothetical ones.