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

Re: LOAD-TIME-EVAL



> Dalton's approach is clever, but is not adequate for a number of reasons in
> any serious application. Here are a few that come quickly to mind ...
> 
>  - I'm not convinced that the spec for either the compiler or GENSYM is
>    written in a constrained enough way to make me believe that all compilers
>    will correctly handle the writing out and re-loading of that GENSYM.

I agree.  But my eval-once trick seemed the least suspect way of doing this
when I first wrote it, because then it seemed that any quoted or load-time
eval object would not be safely modifiable.  Is the current proposal to
allow modification in some cases?

Anyway, some of the potential gensym problems can be eliminated if the
gensym appears exactly once in the source.  For example:

(defmacro eval-once (form)
  `(let ((v ',(gensym)))		;the symbol persists between calls
     (if (boundp v)
	 (symbol-value v)
       (set v ,form))))

I had thought that write/re-load problems with gensym were confined to
systems like KCL that were incorrect on other grounds.  If this is not
so, cleanup issues seem in order.

-- Jeff