I came across something, which seem odd to me:
- If I remove an instance from a kids slot, not-to-be is called on that instance - If I remove an instance form any :owning t slot, not-to-be is called on that instance - If not-to-be is called on an instance, it is also called on all its kids
BUT
If not-to-be is called on an instance, it is NOT called on all instances its :owning t slots.
Is this desired behavior, or dfid it get overlooked when owning was introduced?
What is the recommended way to deal with it?
- write a not-to-be method for my specific class which setfs the owned slots to nil to trigger not-to-be? - write a not-to-be method for my specific class which mapcs not-to-be over its owned slots? or - fix it in cells and change not-to-be there so it does not only recurse down kids, but all owned slots?
Thanks for any advice,
Peter
On Mon, Apr 21, 2008 at 10:12 AM, Peter Hildebrandt peter.hildebrandt@gmail.com wrote:
- fix it in cells and change not-to-be there so it does not only
recurse down kids, but all owned slots?
As a proof of concept, I changed not-to-be to be
(defmethod not-to-be :before ((fm family)) (loop for (slot . nil) in (get (type-of fm) :ownings) do (let ((owned (slot-value fm slot))) (when (listp owned) (mapc #'not-to-be owned)))))
It used to be:
(defmethod not-to-be :before ((fm family)) (let ((sv-kids (slot-value fm '.kids))) (when (listp sv-kids) (dolist ( kid sv-kids) (not-to-be kid))))
I haven't committed it yet, because I'd like to hear your opinion, especially on what this might break :-)
Peter
On Mon, Apr 21, 2008 at 10:38 AM, Peter Hildebrandt peter.hildebrandt@gmail.com wrote:
As a proof of concept, I changed not-to-be to be
There's something weird going on, i.e. it is not called reliably on the kids slot. The follwoing works better:
(defmethod not-to-be :before ((fm family)) (let ((sv-kids (slot-value fm '.kids))) (when (listp sv-kids) (dolist ( kid sv-kids) (not-to-be kid)))) (bwhen (ownings (get (type-of fm) :ownings) ) (loop for (slot . nil) in ownings do (unless (eql slot '.kids) (bwhen (owned (slot-value fm slot)) (if (listp owned) (mapc #'not-to-be owned) (not-to-be owned)))))))
It used to be:
(defmethod not-to-be :before ((fm family)) (let ((sv-kids (slot-value fm '.kids))) (when (listp sv-kids) (dolist ( kid sv-kids) (not-to-be kid))))
I haven't committed it yet, because I'd like to hear your opinion, especially on what this might break :-)
Peter