Discussion:
mop reader-method-class writer-method-class
(too old to reply)
Madhu
2020-04-04 13:25:09 UTC
Permalink
Hello. MOP specifies the classes standard-reader-method,
standard-accessor-method, and standard-writer-method. But I can't
imagine how these could be used to modify standard behaviour - is there
an example or was there a use case in mind when this was specified?

I think I have a use case for wanting to "augment" the behaviour of all
accessors (readers and writers) which are specified for a certain class.

I don't want to go through s-v-u-c - but only want the "augmenteded
behaviour" for those accessors which declared/defined by the users of
the class.

I understand I can subclass standard-reader-method and
standard-writer-method (say with x-reader-method x-writer-method),
define a suitable metaclass x define the methods reader-method-class and
writer-method-class on x to return x-reader-method and x-writer-method.

Then the accessor methods are instances of my x-reader-method and
x-writer-method. But how would I use these meta objects?

I thought perhaps make-method-lambda (say specialized on
standard-generic-function and x-writer-method) could be used to inject
some code into all methods, but this would never get called as there is
no defmethod involved.

any clue[bat]
Madhu
2020-05-29 04:31:40 UTC
Permalink
Post by Madhu
Hello. MOP specifies the classes standard-reader-method,
standard-accessor-method, and standard-writer-method. But I can't
imagine how these could be used to modify standard behaviour - is there
an example or was there a use case in mind when this was specified?
I am revisiting this, and am very shaky on the mop,

smh can I get a comment please?
Post by Madhu
I think I have a use case for wanting to "augment" the behaviour of all
accessors (readers and writers) which are specified for a certain class.
I don't want to go through s-v-u-c - but only want the "augmenteded
behaviour" for those accessors which declared/defined by the users of
the class.
I understand I can subclass standard-reader-method and
standard-writer-method (say with x-reader-method x-writer-method),
define a suitable metaclass x define the methods reader-method-class and
writer-method-class on x to return x-reader-method and x-writer-method.
Then the accessor methods are instances of my x-reader-method and
x-writer-method. But how would I use these meta objects?
I thought perhaps make-method-lambda (say specialized on
standard-generic-function and x-writer-method) could be used to inject
some code into all methods, but this would never get called as there is
no defmethod involved.
Loading...