[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (setf (foo #) value), foo being undefined yet
- To: clisp-list
- Subject: Re: (setf (foo #) value), foo being undefined yet
- From: haible (Bruno Haible)
- Date: Sun, 9 May 93 22:08:21 +0200
Joerg Hoehle writes:
> I wonder whether the above code using a yet undefined setf is correct
> for CLtLI or CLtLII. In CLtLII, setf, seeing an unknown (setf (f #) #)
> form, has been expanded to produce a call to the (setf f) function,
> whereas in CLtLI (setf f) was not considered as being a function name.
True.
> I'm not sure whether the above code intended to make use of this
> extended setf behaviour and thus was written for CLtLII.
Apparently.
> I'm tempted to believe that the above code is wrong w.r.t. both
> standards and that it should have been written in another way
It is wrong only w.r.t. CLTL1, but is will be a good idea to change
the macroexpansion of (DEFROUTINE ...) from
(PROGN
(DEFUN ADD1-NAM** (N)
(LET ((N (EVAL N)))
(COND ((< (I**) N) (SETF (E**) (+ (E**) 1))) (T NIL))
(VALUES)
) )
(DEFMACRO ADD1-NAM (E I N)
`(PROGN
,@(DEFTHUNK 'E** E)
,@(DEFTHUNK 'I** I)
(MULTIPLE-VALUE-BIND NIL (ADD1-NAM** ,N))
NIL
) ) )
to something like
(PROGN
(EVAL-WHEN (COMPILE LOAD EVAL)
,@(DEFTHUNK 'E** E)
,@(DEFTHUNK 'I** I)
)
(DEFMACRO ADD1-NAM (E I N)
(ONCE-ONLY (E I N)
`(PROGN
(COND ((< (I**) N) (SETF (E**) (+ (E**) 1))) (T NIL))
(VALUES)
) ) )
)
Bruno Haible
haible@ma2s2.mathematik.uni-karlsruhe.de