Bug in poplog clisp: defclass :writer behaviour differs from spec
Hello,
I think I've discovered a bug in the poplog clisp implementation of
:writer arguments in defclass. In short, (myslot :writer w) should
generate a function/method to be used as (w new-val myobj), but instead
it has to be used as (setf (w myobj) new-val), which is wrong and
incompatible with other Common Lisp implementations like CLISP and CMUCL.
Expected behaviour from Steele CLtL 2nd edition:
28.1.2.4. Accessing Slots
[...]
If the name specified for the writer option is the symbol name,
the name of the generic function for writing the slot is the
symbol name, and the generic function takes two arguments:
the new value and the instance, in that order.
If the name specified for the accessor option is the symbol name,
the name of the generic function for reading the slot is the
symbol name, and the name of the generic function for writing
the slot is the list (setf name).
[...]
From this description, it seems clear to me that specifying an accessor
should generate a writer with the (setf (w myobj) new-val) usage, but
specifying a writer directly should not.
However, pop/lisp/src/clos.p seems to generate the same setf-oriented
methods/functions for both :writer and :accessor options:
Lines 554 ff.:
elseif option == @:WRITER then
pushnew(Get_val(), writers) -> writers
elseif option == @:ACCESSOR then
Get_val() -> item;
pushnew(item, readers) -> readers;
pushnew(item, writers) -> writers
And later, around lines 781 ff.:
if writers then
[^v ^i] -> lamlist;
for p in writers do
define_method(
ensure_generic_function(
[% @SETF, front(p) %], nil, [], lamlist, [], []),
nil, [], lamlist, [^@T ^c],
updater(slot_value)(% back(p) %)) ->;
endfor
endif
I'm using POPLOG version 15.6.
(And thanks for such a nice system.)
Cheers,
Andreas
|