[rucksack-devel] MOP
Levente Mészáros
levente.meszaros at gmail.com
Tue Jan 16 15:41:42 UTC 2007
Hi,
The following patch separates persistent and standard slots in a
persistent-class instance during class finalization based on the
:persistence slot parameter. It also further specializes svuc and
friends on persistent-class and friends.
The patch allows subclassing non persistent classes and even non
standard classes by a persistent class in a more flexible way and
mixing meta class behaviour with other meta classes.
Basic tests were passed.
RS-TEST> (defclass foo ()
((foo-slot)))
#<STANDARD-CLASS FOO>
RS-TEST> (defclass bar (foo)
((bar-slot))
(:metaclass persistent-class))
#<PERSISTENT-CLASS BAR>
RS-TEST> (class-slots (find-class 'foo))
(#<STANDARD-EFFECTIVE-SLOT-DEFINITION FOO-SLOT>)
RS-TEST> (class-slots (find-class 'bar))
(#<STANDARD-EFFECTIVE-SLOT-DEFINITION FOO-SLOT>
#<STANDARD-EFFECTIVE-SLOT-DEFINITION OBJECT-ID>
#<STANDARD-EFFECTIVE-SLOT-DEFINITION TRANSACTION-ID>
#<STANDARD-EFFECTIVE-SLOT-DEFINITION RUCKSACK>
#<RUCKSACK::PERSISTENT-EFFECTIVE-SLOT-DEFINITION BAR-SLOT>)
The patch consists of the following:
- removed the persistence slot from the persistent-slot-mixin because
a slot will be persistent iff it is of type persistent-slot-mixin
- modified copy-slot-definition and slot-definition-equal accordingly
- added preprocessing code to initialize- and reinitialize-instance
around persistent-class which adds the default :persistence t
parameter to direct slot specifications if not specified and removes
it if :persistence nil is specified
- modified direct-slot-definition-class and
effective-slot-definition-class to return persistent classes only when
persistence is t
- modified compute-effective-slot-definition so that it does not set
slot-persistence any more
- modified persistent-object so that it does not send :index nil to
non persistent slots since it is not understood by
standard-slot-definition
- modified slot-value-using-class and (setf slot-value-using-class)
and slot-makunbound-using-class to be primary methods instead of
around methods dispatching on persistent-class, persistent-object and
persistent-effective-slot-definition because this is more flexible
when merging the persistent mop with other mop classes such as
computed-class, etc.
- refactored lispworks specific slot-value-using-class and friends to
support when the non standard slot name is given instead of a real
slot object. this has to be verified since I do not have a lispworks
environment here
Cheers,
levy
--
There's no perfectoin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mop.patch
Type: text/x-patch
Size: 16135 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/rucksack-devel/attachments/20070116/5bd1f5d8/attachment.bin>
More information about the rucksack-devel
mailing list