[pro] AMOP question: When and where is slot-value-using-class called?

Hans Hübner hans.huebner at gmail.com
Sun Aug 3 07:50:11 UTC 2014


Jean-Claude,

the basic point that the other, more knowledgeable responders made, was:
 You cannot define a method on slot-value-using-class specializing on
standard-class and expect the same behavior across implementations.  This
is because standard-class may be used within the lisp implementation itself
and/or be treated by the compiler differently to achieve better
performance.  If you want to use slot-value-using-class, you need to define
your own metaclass and specialize the methods on that.

-Hans


2014-08-03 9:40 GMT+02:00 Jean-Claude Beaudoin <
jean.claude.beaudoin at gmail.com>:

>
> On Sat, Aug 2, 2014 at 7:38 AM, Pascal Costanza <pc at p-cos.net> wrote:
>
>>
>> On 2 Aug 2014, at 06:35, Jean-Claude Beaudoin <
>> jean.claude.beaudoin at gmail.com> wrote:
>>
>> > I think I found the subsection you refer to: AMOP  5.3.1 (pp. 142-144)
>> "Implementation and User Specialization", which contains two
>> sub-subsections with titles starting with "Restrictions on".
>> > I will try to decipher those and their implications now that I have
>> renewed motivation to do so.
>>
>>
>> There are similar restrictions defined in
>> http://www.lispworks.com/documentation/HyperSpec/Body/11_abab.htm -
>> bullet 19.
>>
>>
> I missed that one too. Thank you for pointing it out.
>
> But after modifying my test code to take account of it I saw no difference
> in the results.
> It turns out that it is the last bullet of the sub-subsection
> "Restrictions on Portable Programs" that is the key factor in the issue I
> am interested in here (last bullet of page 144 in AMOP, or here
> <http://franz.com/support/documentation/current/doc/mop/concepts.html#portable>
> as pointed by Steve). It basically states that the defmethod on
> slot-value-using-class must happen before any call to make-instance on a
> class the method uses as a specializer. (And then goes on to motivate this
> definition order restriction).
> If I modify my test code to comply with this rule (see slot_mop_strict.lsp
> here attached) then sbcl stops being the odd man out and behaves like clisp
> and ACL (which I think is the proper behavior).
>
> Further, if I agree to stop tickling the system where it does not like to
> be tickled and define a class tracked_class as a subclass of standard-class
> to be used as a metaclass of the classes I want to track (see
> slot_mop_strict_tracked_class.lsp here attached), then all of sbcl, clisp,
> ccl and ACL show the same behavior, properly calling slot-value-using-class
> both from slot-value or from the slot accessor. Only LispWorks persists in
> its (erroneous, I think) behavior of calling s-v-u-c only from slot-value.
> I think there is a consensus emerging here.
>
> Thank you all for your help on this matter with a special emphasis toward
> Steve.
>
>
>
>
>
> _______________________________________________
> pro mailing list
> pro at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/pro
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20140803/e9706cb6/attachment.html>


More information about the pro mailing list