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


> 	      (+ I-HOPE-THIS-IS-UNIQUE-0001
> 	2) ...
> Anyone who asks that #, be flushed is, in effect, asking me to write
> this kind of stuff. Among other things, it forces the creation of
> numerous extra symbols and it may require an indirect access to the
> value (through the symbol's value cell) in some implementations where
> an immediate move (or even an instruction that utilizes a constant
> operand) might have been possible if quote were used.

Although I agree with Kent's point that load-time eval is useful and
better than many of the alternatives (especially since some of the
alternatives don't quite work), the "I hope this is unique" problem
can often be reduced.

In some other languages I can use static variables 

    int f()
        static int initialized = FALSE;
        static int v1, v2, ...;
        if not(initialized)
            v1 = ...;
            v2 = ...;
        ... procedure body code ...

This is not ideal, of course.

Similar tricks can be done in Lisp (I think) by generating global

(defmacro eval-once (form)
  (let ((v (gensym)))
    `(locally (declare (special ,v))
       (if (boundp ',v)			;initialized?
         (setq ,v ,form)))))