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

Re: issue SYNTACTIC-ENVIRONMENT-ACCESS, version 5



    Date: Wed, 22 Mar 89  15:27:20 CST
    From: David N Gray <Gray@DSG.csc.ti.com>

    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

    or

    (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
    (2).  

You're right.  Not only the compiler, also the interpreter would have to do
the extra bookkeeping.  I didn't regard recording those declarations (as
opposed to acting on them) to be a significant effort, but I might be wrong.

    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.  

This is no longer true.  With the introduction of the concept of "safe code",
it's necessary to know the OPTIMIZE SAFETY level in anything that does not
unconditionally produce safe 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 would, just because the code is larger.

		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.

I do see your point though.

    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.

I didn't think the list returned by DECLARATION-INFORMATION would be actually
consed until you asked for it; the information could be remembered in some
other form.  The use of a list here was just to maximize the simplicity
and minimize the functionality of the interface.

Would it be reasonable to say that declarations that pertain to variable
bindings and function definitions are remembered at the discretion of the
implementation, but that other declarations (the kind you get at with
DECLARATION-INFORMATION) must be remembered?

Or are we concluding that we're not really ready to standardize
anything for SYNTACTIC-ENVIRONMENT-ACCESS?