[CM] Bug in (apply set! ..)
bil at ccrma.Stanford.EDU
bil at ccrma.Stanford.EDU
Mon Feb 21 15:06:12 PST 2022
I don't immediately see the bug.
apply evaluates all its arguments, and set! evaluates
its second argument, so
(define x 'foo)
(apply set! 'x 'bar ())
becomes (#_set! x bar), but bar is not defined when
evaluated by set! Similarly
(define bar 'the-bar)
(apply set! 'x bar ()) ; bar is not quoted -> 'the-bar
becomes (#_set! x the-bar) because bar evaluates to the-bar
which set! tries to evaluate (as a symbol), but it is not
defined.
(apply set! 'x 'bar ())
becomes (#_set! x bar) where bar is 'the-bar, so
x is set to 'the-bar, so (eq? x 'the-bar) is #t.
There is one level of evaluation here for the
car (set! -> #_set!) and the target of set!, but
two levels for the value (apply does one, and
set! the other).
More information about the Cmdist
mailing list