From: Frank GOENNINGER
Subject: (setf slot-value-using-class) not working ...
Date:
Message-ID: <lzabck4dwd.fsf@goenninger.net>
Dear MOP Gurus!
I want to intercept the setf of a slot.
So I have that simple class
(defclass frgo ()
((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
and do:
(defmethod (setf slot-value-using-class) :before
(new-value (class frgo) object slot)
(format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
= ~s~%" new-value object slot))
... just for testing purposes.
1st question: Why do I never land in this method?
2nd question: How do I best debug MOP method selection?
3rd question: How do I specialize on exactly one specific slot (this
method should only get calles when slot-1 is setf'ed ...)
Thanks!!!
Cheers
Frank
--
Frank Goenninger
"Don't ask me! I haven't been reading comp.lang.lisp long enough to
really know ..."
In article <··············@goenninger.net>,
Frank GOENNINGER <·············@nomail.org> wrote:
> Dear MOP Gurus!
>
> I want to intercept the setf of a slot.
>
> So I have that simple class
>
> (defclass frgo ()
> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>
> and do:
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class frgo) object slot)
> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
> = ~s~%" new-value object slot))
>
> ... just for testing purposes.
>
> 1st question: Why do I never land in this method?
Because it might not get called. Which Lisp are you
using?
LispWorks says in the documentation:
'by default, standard slot accessors are optimized to not call
slot-value-using-class. This can be overidden with the
:optimize-slot-access class option.'
> 2nd question: How do I best debug MOP method selection?
> 3rd question: How do I specialize on exactly one specific slot (this
> method should only get calles when slot-1 is setf'ed ...)
LispWorks for example passes the slot name. You can
dispatch over it.
>
> Thanks!!!
>
> Cheers
> Frank
--
http://lispm.dyndns.org/
Rainer Joswig wrote:
> In article <··············@goenninger.net>,
> Frank GOENNINGER <·············@nomail.org> wrote:
>
>
>>Dear MOP Gurus!
>>
>>I want to intercept the setf of a slot.
>>
>>So I have that simple class
>>
>>(defclass frgo ()
>> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>>
>>and do:
>>
>>(defmethod (setf slot-value-using-class) :before
>> (new-value (class frgo) object slot)
>> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
>> = ~s~%" new-value object slot))
>>
>>... just for testing purposes.
>>
>>1st question: Why do I never land in this method?
Where the hell is Costanza when we need him?!
> Because it might not get called. Which Lisp are you
> using?
<g> Probably one where the second param is the class instance of the
object (in this case to be specialized on standard class) and the third
(here labelled object) should be specialized on frgo.
(defmethod (setf slot-value-using-class) :before
(new-value (class standard-class) (object frgo) slot)
(format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
= ~s~%" new-value object slot))
But that crashed ACL twice (not nice, I guess, messing with
standard-class) so I sent Frank a metaclass-based hack
> LispWorks says in the documentation:
>
> 'by default, standard slot accessors are optimized to not call
> slot-value-using-class. This can be overidden with the
> :optimize-slot-access class option.'
Interesting. This is the bit Costanza was clueless on. Nice of LW to
expose that, ACL Just Does It.
>>2nd question: How do I best debug MOP method selection?
>>3rd question: How do I specialize on exactly one specific slot (this
>>method should only get calles when slot-1 is setf'ed ...)
>
>
> LispWorks for example passes the slot name. You can
> dispatch over it.
You gotta be kidding. Not the effective-slot-definition instance?! In a
MOP implementation.
I am telling you, it took me years to realize but PG is right, CLOS sucks!
hth, kenny
From: Raffael Cavallaro
Subject: [JOKE] [ANN] New Object System for Common Lisp
Date:
Message-ID: <gegp78$58f$1@aioe.org>
On 2008-10-31 20:30:18 -0400, Kenny <·········@gmail.com> said:
> I am telling you, it took me years to realize but PG is right, CLOS sucks!
ANN: A New Object System for Common Lisp:
Cloned Instances, Generics, And Rules or CIGAR - because the Common
Lisp Object System was CLOS, but no CIGAR!
or...
ANN: A New Object System for Common Lisp:
Cloned Objects Of Kinds, In English or COOKIE - because the Common Lisp
Object System was CLOS, but no COOKIE!
Now that we have the all-important acronyms defining the design space
all we need to hammer out is those pesky implementation details ;^)
From: Raffael Cavallaro
Subject: Re: [JOKE] [ANN] New Object System for Common Lisp
Date:
Message-ID: <gegphe$75a$1@aioe.org>
On 2008-11-01 01:24:56 -0400, Raffael Cavallaro
<················@pas-d'espam-s'il-vous-plait-mac.com> said:
> On 2008-10-31 20:30:18 -0400, Kenny <·········@gmail.com> said:
>
>> I am telling you, it took me years to realize but PG is right, CLOS sucks!
>
> ANN: A New Object System for Common Lisp:
> Cloned Instances, Generics, And Rules or CIGAR - because the Common
> Lisp Object System was CLOS, but no CIGAR!
>
> or...
>
> ANN: A New Object System for Common Lisp:
> Cloned Objects Of Kinds, In English or COOKIE - because the Common Lisp
> Object System was CLOS, but no COOKIE!
>
> Now that we have the all-important acronyms defining the design space
> all we need to hammer out is those pesky implementation details ;^)
On second thought it would be so much easier to keep CLOS, but rename
it to Common Lisp Object Suckage; then both kenny and pg could pat
themselves on the back and stop complaining about it ;^)
Raffael Cavallaro wrote:
> On 2008-11-01 01:24:56 -0400, Raffael Cavallaro
> <················@pas-d'espam-s'il-vous-plait-mac.com> said:
>
>> On 2008-10-31 20:30:18 -0400, Kenny <·········@gmail.com> said:
>>
>>> I am telling you, it took me years to realize but PG is right, CLOS
>>> sucks!
>>
>> ANN: A New Object System for Common Lisp:
>> Cloned Instances, Generics, And Rules or CIGAR - because the Common
>> Lisp Object System was CLOS, but no CIGAR!
>>
>> or...
>>
>> ANN: A New Object System for Common Lisp:
>> Cloned Objects Of Kinds, In English or COOKIE - because the Common
>> Lisp Object System was CLOS, but no COOKIE!
>>
>> Now that we have the all-important acronyms defining the design space
>> all we need to hammer out is those pesky implementation details ;^)
>
> On second thought it would be so much easier to keep CLOS, but rename it
> to Common Lisp Object Suckage; then both kenny and pg could pat
> themselves on the back and stop complaining about it ;^)
:)
I second this suggestion. ;)
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
Kenny wrote:
> Rainer Joswig wrote:
>> In article <··············@goenninger.net>,
>> Frank GOENNINGER <·············@nomail.org> wrote:
>>
>>
>>> Dear MOP Gurus!
>>>
>>> I want to intercept the setf of a slot.
>>>
>>> So I have that simple class
>>>
>>> (defclass frgo ()
>>> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>>>
>>> and do:
>>>
>>> (defmethod (setf slot-value-using-class) :before
>>> (new-value (class frgo) object slot)
>>> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
>>> = ~s~%" new-value object slot))
>>>
>>> ... just for testing purposes.
>>>
>>> 1st question: Why do I never land in this method?
>
> Where the hell is Costanza when we need him?!
You are a pompous ass.
>> Because it might not get called. Which Lisp are you
>> using?
>
> <g> Probably one where the second param is the class instance of the
> object (in this case to be specialized on standard class) and the third
> (here labelled object) should be specialized on frgo.
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class standard-class) (object frgo) slot)
> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
> = ~s~%" new-value object slot))
>
> But that crashed ACL twice (not nice, I guess, messing with
> standard-class) so I sent Frank a metaclass-based hack
At least you admit that you're just guessing.
But this is probably again just the fault of CLOS, not the fault of
Kenny "I am always right" Tilton. Idiot.
>> LispWorks says in the documentation:
>>
>> 'by default, standard slot accessors are optimized to not call
>> slot-value-using-class. This can be overidden with the
>> :optimize-slot-access class option.'
>
> Interesting. This is the bit Costanza was clueless on.
Fuck you, asshole.
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
Pascal Costanza wrote:
> Kenny wrote:
>
>> Rainer Joswig wrote:
>>
>>> In article <··············@goenninger.net>,
>>> Frank GOENNINGER <·············@nomail.org> wrote:
>>>
>>>
>>>> Dear MOP Gurus!
>>>>
>>>> I want to intercept the setf of a slot.
>>>>
>>>> So I have that simple class
>>>>
>>>> (defclass frgo ()
>>>> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>>>>
>>>> and do:
>>>>
>>>> (defmethod (setf slot-value-using-class) :before
>>>> (new-value (class frgo) object slot)
>>>> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
>>>> = ~s~%" new-value object slot))
>>>>
>>>> ... just for testing purposes.
>>>>
>>>> 1st question: Why do I never land in this method?
>>
>>
>> Where the hell is Costanza when we need him?!
>
>
> You are a pompous ass.
Boy. I give you a tip of the hat and this is my thanks?
>
>>> Because it might not get called. Which Lisp are you
>>> using?
>>
>>
>> <g> Probably one where the second param is the class instance of the
>> object (in this case to be specialized on standard class) and the
>> third (here labelled object) should be specialized on frgo.
>>
>> (defmethod (setf slot-value-using-class) :before
>> (new-value (class standard-class) (object frgo) slot)
>> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
>> = ~s~%" new-value object slot))
>>
>> But that crashed ACL twice (not nice, I guess, messing with
>> standard-class) so I sent Frank a metaclass-based hack
>
>
> At least you admit that you're just guessing.
>
> But this is probably again just the fault of CLOS, not the fault of
> Kenny "I am always right" Tilton. Idiot.
Well, when I said "crashed" I did not mean backtrace, I meant bye-bye
runtime, hello desktop. So no one is blaming CLOS or my abundant idiocy,
we just came up with a nice little unit-test for ACL. I know ACL backs
out a lot of optimization dynamically when one defines the first method
on SVUC, so my guess is something has gone way out of bounds in the
process -- it never came back from the method definition itself.
Probably only take an hour to come up with a reproducible for Franz, but
I am way too busy switching from JQuery to Dojo.
>
>>> LispWorks says in the documentation:
>>>
>>> 'by default, standard slot accessors are optimized to not call
>>> slot-value-using-class. This can be overidden with the
>>> :optimize-slot-access class option.'
>>
>>
>> Interesting. This is the bit Costanza was clueless on.
>
>
> Fuck you, asshole.
Erik was right, you really haven't the knack for this. :)
Peace, kt
From: Frank GOENNINGER
Subject: Re: (setf slot-value-using-class) not working ...
Date:
Message-ID: <lz63n7j02o.fsf@goenninger.net>
Kenny <·········@gmail.com> writes:
> Rainer Joswig wrote:
>> In article <··············@goenninger.net>,
>> Frank GOENNINGER <·············@nomail.org> wrote:
>>
>>
>>>Dear MOP Gurus!
>>>
>>>I want to intercept the setf of a slot.
>>>
>>>So I have that simple class
>>>
>>>(defclass frgo ()
>>> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>>>
>>>and do:
>>>
>>>(defmethod (setf slot-value-using-class) :before
>>> (new-value (class frgo) object slot)
>>> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
>>> = ~s~%" new-value object slot))
>>>
>>>... just for testing purposes.
>>>
>>>1st question: Why do I never land in this method?
>
> Where the hell is Costanza when we need him?!
>
>> Because it might not get called. Which Lisp are you
>> using?
ACL 8.1 Express Edition
> <g> Probably one where the second param is the class instance of the
> object (in this case to be specialized on standard class) and the
> third (here labelled object) should be specialized on frgo.
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class standard-class) (object frgo) slot)
> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
> = ~s~%" new-value object slot))
>
> But that crashed ACL twice (not nice, I guess, messing with
> standard-class) so I sent Frank a metaclass-based hack
Thx!
> hth, kenny
It does! ;-)
Cheers
Frank
Rainer Joswig wrote:
> In article <··············@goenninger.net>,
> Frank GOENNINGER <·············@nomail.org> wrote:
>
>> Dear MOP Gurus!
>>
>> I want to intercept the setf of a slot.
>>
>> So I have that simple class
>>
>> (defclass frgo ()
>> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>>
>> and do:
>>
>> (defmethod (setf slot-value-using-class) :before
>> (new-value (class frgo) object slot)
>> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
>> = ~s~%" new-value object slot))
>>
>> ... just for testing purposes.
>>
>> 1st question: Why do I never land in this method?
>
> Because it might not get called. Which Lisp are you
> using?
>
> LispWorks says in the documentation:
>
> 'by default, standard slot accessors are optimized to not call
> slot-value-using-class. This can be overidden with the
> :optimize-slot-access class option.'
This is LispWorks-specific, indeed. The problem in the OP's code was
somewhere else, though.
>> 2nd question: How do I best debug MOP method selection?
>> 3rd question: How do I specialize on exactly one specific slot (this
>> method should only get calles when slot-1 is setf'ed ...)
>
> LispWorks for example passes the slot name. You can
> dispatch over it.
The CLOS MOP specification requires the slot definition metaobject,
which is the case in all CLOS implementations except for LispWorks.
Both "issues" (:optimize-slot-access and specialization on slot names
instead slot definition metaobjects) are "fixed" in Closer to MOP.
(If you restrict yourself to LispWorks, these are actually not real
problems, you just have to be aware of these deviations from the CLOS
MOP specification.)
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Frank GOENNINGER
Subject: Re: (setf slot-value-using-class) not working ...
Date:
Message-ID: <lzabcjj0g3.fsf@goenninger.net>
Rainer Joswig <······@lisp.de> writes:
> In article <··············@goenninger.net>,
> Frank GOENNINGER <·············@nomail.org> wrote:
>>
>> 1st question: Why do I never land in this method?
>
> Because it might not get called. Which Lisp are you
> using?
>
> LispWorks says in the documentation:
>
> 'by default, standard slot accessors are optimized to not call
> slot-value-using-class. This can be overidden with the
> :optimize-slot-access class option.'
A-ha!
>> 3rd question: How do I specialize on exactly one specific slot (this
>> method should only get calles when slot-1 is setf'ed ...)
>
> LispWorks for example passes the slot name. You can
> dispatch over it.
Thx for the info, Rainer. Not on LW here, though.
Kind regards
Frank
--
Frank Goenninger
"Don't ask me! I haven't been reading comp.lang.lisp long enough to
really know ..."
Frank GOENNINGER wrote:
> Dear MOP Gurus!
>
> I want to intercept the setf of a slot.
>
> So I have that simple class
>
> (defclass frgo ()
> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>
> and do:
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class frgo) object slot)
> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
> = ~s~%" new-value object slot))
>
> ... just for testing purposes.
>
> 1st question: Why do I never land in this method?
Because the class frgo is an instance of standard-class, not of frgo.
> 2nd question: How do I best debug MOP method selection?
You can debug CLOS MOP code like regular CLOS code. It _is_ regular CLOS
code after all.
> 3rd question: How do I specialize on exactly one specific slot (this
> method should only get calles when slot-1 is setf'ed ...)
First the general solution:
(defclass frgo-class (standard-class) ())
(defmethod validate-superclass
((class frgo-class) (superclass standard-class))
t)
(defmethod (setf slot-value-using-class) :before
(new-value (class frgo-class) object slot)
(format ...))
(defclass frgo-object (standard-object)
((slot-1 :accessor slot-1 :initform nil :initarg :slot-1))
(:metaclass frgo-class))
The essential thing here is that a class needs to be an instance of a
metaclass other than standard-class in order to have accesses to slots
intercepted at the metalevel. (Furthermore: Don't attempt to specialize
just the object parameter and not the class parameter in s-v-u-c, that
won't work in many CLOS implementations, which is actually sanctioned by
the CLOS MOP specification.)
If you want to specialize only specific slots, here is the general pattern:
(defclass frgo-effective-slot-definition
(standard-effective-slot-definition)
())
(defmethod effective-slot-definition-class
((class frgo-class) &rest initargs)
(find-class 'frgo-effective-slot-definition))
;;; and then replace the methods for s-v-u-c with this:
(defmethod (setf slot-value-using-class) :before
(new-value
(class frgo-class)
object
(slotd frgo-effective-slot-definition))
...)
Here, slots of the metaclass standard-effective-slot-definition (the
default) won't be affected by this method. However, currently all slots
for frgo-classes will be instances of frgo-effective-slot-definition.
The good news is that effective-slot-definition-class can make decisions
based on properties of the slot at hand. This is a bit more involved
because effective-slot-definition-class doesn't see all these
properties, but you can pass such information over via special variables
from compute-effective-slot-definition. You may want to look at the
source code of ContextL for examples how to do this (for example in the
metaclass special-class).
I hope this helps.
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
Pascal Costanza <··@p-cos.net> writes:
> First the general solution:
>
> (defclass frgo-class (standard-class) ())
>
> (defmethod validate-superclass
> ((class frgo-class) (superclass standard-class))
> t)
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class frgo-class) object slot)
> (format ...))
>
> (defclass frgo-object (standard-object)
> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1))
> (:metaclass frgo-class))
>
> The essential thing here is that a class needs to be an instance of a
> metaclass other than standard-class in order to have accesses to slots
> intercepted at the metalevel. (Furthermore: Don't attempt to
> specialize just the object parameter and not the class parameter in
> s-v-u-c, that won't work in many CLOS implementations, which is
> actually sanctioned by the CLOS MOP specification.)
Pascal-
I hope you realize that I have found nowhere a good repository of
succint recipes on how to do cool things with CLOS.
I own and have read TAOTMP, Keene's book, these either focus on the
simple parts of CLOSE (Keene) or have minimal useful examples.
The closest thing I could image would be a good search of your
previous posts + some judicious editing.
> If you want to specialize only specific slots, here is the general pattern:
>
> (defclass frgo-effective-slot-definition
> (standard-effective-slot-definition)
> ())
>
> (defmethod effective-slot-definition-class
> ((class frgo-class) &rest initargs)
> (find-class 'frgo-effective-slot-definition))
>
> ;;; and then replace the methods for s-v-u-c with this:
>
> (defmethod (setf slot-value-using-class) :before
> (new-value
> (class frgo-class)
> object
> (slotd frgo-effective-slot-definition))
> ...)
>
> Here, slots of the metaclass standard-effective-slot-definition (the
> default) won't be affected by this method. However, currently all
> slots for frgo-classes will be instances of
> frgo-effective-slot-definition. The good news is that
> effective-slot-definition-class can make decisions based on properties
> of the slot at hand. This is a bit more involved because
> effective-slot-definition-class doesn't see all these properties, but
> you can pass such information over via special variables from
> compute-effective-slot-definition. You may want to look at the source
> code of ContextL for examples how to do this (for example in the
> metaclass special-class).
>
> I hope this helps.
Yet another example of the above.
-russ
From: Frank GOENNINGER
Subject: Re: (setf slot-value-using-class) not working ...
Date:
Message-ID: <lzzlkjhgcd.fsf@goenninger.net>
Pascal Costanza <··@p-cos.net> writes:
> Frank GOENNINGER wrote:
>>
>> 1st question: Why do I never land in this method?
>
> Because the class frgo is an instance of standard-class, not of frgo.
And that turned the light on for me - thanks!
>> 2nd question: How do I best debug MOP method selection?
>
> You can debug CLOS MOP code like regular CLOS code. It _is_ regular
> CLOS code after all.
Yep. So my question should have been phrased differently. But hey, I
found out meanwhile ;-)
>
>> 3rd question: How do I specialize on exactly one specific slot (this
>> method should only get calles when slot-1 is setf'ed ...)
>
> First the general solution:
>
> (defclass frgo-class (standard-class) ())
>
> (defmethod validate-superclass
> ((class frgo-class) (superclass standard-class))
> t)
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class frgo-class) object slot)
> (format ...))
>
> (defclass frgo-object (standard-object)
> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1))
> (:metaclass frgo-class))
>
> The essential thing here is that a class needs to be an instance of a
> metaclass other than standard-class in order to have accesses to slots
> intercepted at the metalevel. (Furthermore: Don't attempt to
> specialize just the object parameter and not the class parameter in
> s-v-u-c, that won't work in many CLOS implementations, which is
> actually sanctioned by the CLOS MOP specification.)
>
>
> If you want to specialize only specific slots, here is the general pattern:
>
> (defclass frgo-effective-slot-definition
> (standard-effective-slot-definition)
> ())
>
> (defmethod effective-slot-definition-class
> ((class frgo-class) &rest initargs)
> (find-class 'frgo-effective-slot-definition))
>
> ;;; and then replace the methods for s-v-u-c with this:
>
> (defmethod (setf slot-value-using-class) :before
> (new-value
> (class frgo-class)
> object
> (slotd frgo-effective-slot-definition))
> ...)
>
> Here, slots of the metaclass standard-effective-slot-definition (the
> default) won't be affected by this method. However, currently all
> slots for frgo-classes will be instances of
> frgo-effective-slot-definition. The good news is that
> effective-slot-definition-class can make decisions based on properties
> of the slot at hand. This is a bit more involved because
> effective-slot-definition-class doesn't see all these properties, but
> you can pass such information over via special variables from
> compute-effective-slot-definition. You may want to look at the source
> code of ContextL for examples how to do this (for example in the
> metaclass special-class).
>
>
> I hope this helps.
It certainly does. Now working on implementing it for my case here ...
>
>
> Pascal
Thanks, Pascal! Oh, and yes, I am using closer-mop here. I do need the
portability of all this. Thanks again for providing it!
Kind regards
Frank
--
Frank Goenninger
"Don't ask me! I haven't been reading comp.lang.lisp long enough to
really know ..."
Frank GOENNINGER wrote:
> I want to intercept the setf of a slot.
>
> So I have that simple class
>
> (defclass frgo ()
> ((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
>
> and do:
>
> (defmethod (setf slot-value-using-class) :before
> (new-value (class frgo) object slot)
> (format *debug-io* "S-V-U-C calles: new-value = ~s, object = ~s, slot
> = ~s~%" new-value object slot))
>
> ... just for testing purposes.
By the way, you can have it easier by avoiding the CLOS MOP:
(defclass frgo ()
((slot-1 :accessor slot-1 :initform nil :initarg :slot-1)))
(defmethod (setf slot-1) :before
(new-value (object frgo))
...)
It's good style to prefer accessors over slot-value in the general case,
and use slot-value only for low-level, class-internal accesses. To make
this clear, it's for example good to use a different name for the slot
and not export it from your package. That gives you the freedom to
intercept slot accesses without going through the heavy machinery of the
CLOS MOP. Another advantage is that this should be generally more
efficient. (Accessors can in general be implemented more efficiently
than slot-value access, and methods on slot-value-using-class are likely
to have a negative impact on efficiency.)
It's better to use the CLOS MOP for 'real' language extensions.
(Yes, these suggestions are all fuzzy... ;)
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/