[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon, 31 Jan 2005 11:36:09 +0000 (UTC) 
Subject:Re: Bug in poplog clisp: defclass :writer behaviour differs from spec 
From:Aaron Sloman 
Volume-ID: 

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!

> Date: Mon, 31 Jan 2005 10:15:00 +0000 (UTC)
> Organization: cs.bham.ac.uk MAIL->NEWS gateway
>
> 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 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?

> I'm using POPLOG version 15.6.

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

> (And thanks for such a nice system.)

Many people have contributed over many years.

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