Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Bug in poplog clisp: defclass :writer behaviour differs from spec
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 27th March 08:57
External User
 
Posts: 1
Default 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
  Reply With Quote


  sponsored links


2 27th March 08:57
aaron sloman
External User
 
Posts: 1
Default Bug in poplog clisp: defclass :writer behaviour differs from spec



Thanks Andreas

[Your message was forwarded from pop-forum to comp.lang.pop]

How nice to find someone who not only uses poplog lisp but can
identify bug-fixes!


I am not a lisp user, so I'll leave a bit of time for others to comment
before taking any action.

If there is no counter-response, this will go into

http://www.cs.bham.ac.uk/research/poplog/bugfixes/BUGREPORTS

along with a change to the lisp sources.

Could you send me a bit of lisp code to use for testing any such
change please?

Good to know that that is being taken up so quickly.

Many people have contributed over many years.

Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666