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

Re: proposal LOAD-TIME-EVAL:REVISED-NEW-SPECIAL-FORM



    Date: Wed, 21 Sep 88  16:19:00 CDT
    From: David N Gray <Gray@DSG.csc.ti.com>
    ...
    (DEFMACRO LOAD-TIME-VALUE (EXP)
      (IF (compiling-p)
	  `(some-special-thing-only-the-compiler-cares-about ',EXP)
	`(QUOTE ,(EVAL EXP))))
    ...

This still makes the programmer's intent opaque to code analysis tools.
I insist that there is nothing odd about a LOAD-TIME-VALUE expression
and that code walkers should be able to expect it and do reasonable
things with it.

For example, I once got a warning from a compiler about something like:
 (* (THE FLOAT '#,(SQRT PI)) ...)
because '(#:MAGIC-MARKER SQRT PI) was a quoted value (and hence subject
to compiler scrutiny) and the constant was not a FLOAT. This was obviously
just a bug because the compiler should expect whatever magic it uses
internally to make #, work, but it can happen to users, too.
If the special thing that only the compiler knows about is going to be
the result of
 (MACROEXPAND '(LOAD-TIME-VALUE (SQRT PI))
then I cannot trivially write code-analysis tools which will be able to
call MACROEXPAND and say of the result: "Oh, this is a value that will
not be known until runtime. I can (a) defer further analysis to runtime,
or (b) try to infer things about what the result of a SQRT call might
be, or ... (*) give up knowing I did the best I could."
Instead it will say ``Gosh, here is a special form I never heard of''
or ``Gosh, here's an undefined function I should warn the user about''
or whatever.

There is no reason for every implementation to use a gratuitously
different marker, or a gratuitously different convention about whether
it's (marker . form) or (marker form). We might as well document that
LIST is how it's composed and we might as well make a standard variable
that holds the marker because it can only improve portability to do so
and because there is no runtime overhead in not doing so. But then we'd
be doing
 (EQ (CAR FORM) COMPILER:*SHARP-COMMA-MARKER*)
rather than
 (EQ (CAR FORM) 'LOAD-TIME-VALUE)
and I don't see the point. It's not like either of them is genuinely
inaccessible so it could still get into places you didn't want it.
Better to just define the marker (an interned symbol comes to mind),
define places where it makes sense (the car of a form in a
for-evaluation position comes to mind) -- in effect, to define it to
be the special form that it obviously is. We keep using the word "magic"
-- all other magic in the language is accomplished by special forms.
Let's just be uniform and call this a special form, too.