[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LOAD-TIME-EVAL
- To: Gray@DSG.csc.ti.com
- Subject: Re: LOAD-TIME-EVAL
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Fri, 9 Sep 88 19:25 EDT
- Cc: KMP@STONY-BROOK.SCRC.Symbolics.COM, CL-Compiler@SAIL.Stanford.EDU
- In-reply-to: <2798835110-1881175@Kelvin>
Date: Fri, 9 Sep 88 17:11:50 CDT
From: David N Gray <Gray@DSG.csc.ti.com>
... After being forced to think about this more deeply and re-reading the
proposal, I am now more favorably inclined towards the proposal
LOAD-TIME-EVAL:NEW-SPECIAL-FORM. ...
Well, I'm glad I'm finally taking the time to write down some of my
thoughts on this instead of quietly fuming every time I see mail on
this that disagrees with what I'm thinking. And I very much appreciate
your taking the time to do all this extra study.
The only serious objection I have left is that the name LOAD-TIME-CONSTANT
ought to be changed since the word "constant" seems misleading. Maybe
something like EVAL-AT-LOAD-TIME ?
My problem with anything that has "EVAL" in it is that it gets involved in
problems of quoting. I think people would expect EVAL-AT-LOAD-TIME to do
`double evaluation' that EVAL is always accused of doing (once at argument
evaluation time, once in the function itself).
I also would prefer a name that was passive rather than active for similar
reasons and for reasons of personal stylistic preference.
How would LOAD-TIME-VALUE strike you?
An interesting issue that I don't remember if I addressed was whether
multiple values could fall through. If you believed in such things, you
might like LOAD-TIME-VALUES.
The reason that I mention this is that maybe we should take the hint from
the people who've referred to own variables and call the form OWN-VALUE
(or OWN-VALUES). [I thought for a while about an OWN declaration on a
variable, but since the tradition in Lisp is to base things around the
objects and not the homes, it seemed to make more sense to allow anonymous
`own quantities' so I ruled out OWN declarations in favor of such a form.]
Then we could write:
(AREF *FORTRAN-MEMORY*
(OWN-VALUE (LOOKUP-FUNCTION-VARIABLE-OFFSET 'FOO 'X)))
Compilers would naturally do something somewhat smart with the following,
and could easily be made a lot smarter with a little work:
(DEFUN FOO (X)
(AREF *FORTRAN-MEMORY*
(+ (OWN-VALUE (LOOKUP-FUNCTION-VARIABLE-OFFSET 'FOO 'X)) X)))
eg, some compilers could just rewrite this internally as
(SETF (SYMBOL-FUNCTION 'FOO)
(LET ((TEMP-0001 (LOOKUP-FUNCTION-VARIABLE-OFFSET 'FOO 'X)))
#'(LAMBDA (X)
(AREF *FORTRAN-MEMORY* (+ TEMP-0001 X)))))
I could even imagine some fan of own variables coming up with:
(DEFMACRO WITH-OWN-VARIABLES (BINDINGS &BODY DECLS-AND-FORMS)
`(LET ,(MAPCAR #'(LAMBDA (BINDING)
`(,(CAR BINDING) (OWN-VALUE ,(CADR BINDING))))
BINDINGS)
,@FORMS))
Thinking about this made me wonder if
(MULTIPLE-VALUE-BIND (X Y Z) (OWN-VALUE (F)) ...)
should work, which is why I wondered if it shouldn't be OWN-VALUES.
Buy any of this?
[If not, do you at least buy my arguments for not using your proposed
name and preferring something that (a) doesn't have EVAL and (b) is
passive in structure?]