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

Re: Side effecting constants inside functions

    Date: Mon 2 Sep 85 22:01:34-PDT
    From: Evan Kirshenbaum <evan@SU-CSLI.ARPA>

    (defmacro compute-once (form)
      (let ((var (gensym)))
	`(if (boundp ',var)
	     (setf ,var ,form))))

    This lacks the self-modifying-ness of the original example.

And it doesn't work, if you run it interpreted and the interpreter
handles macros in the straightforward way (no automatic memoization,
etc).  A new symbol is created each time by the call to gensym.

I believe that the claim in CLtL that the interpreter and the compiler
have precisely the same semantics "so far as possible" must be read with
the understanding that the semantics can differ in the face of macros
whose expansion causes side-effects.