hi!<br><br>i was expecting that when i setf a :component slot then the place slot of the new value (the place slot of the new component to be put in the :component slot) is automagically updated.<br><br>unfortunately it didn't happen... :)
<br><br>then i started to play around in standard-component-class.lisp and tried to implement it but i got lost... i don't see the big picture and therefore i'm not sure that it is a good idea at all (i may also be missing some mechanism that already solves this).
<br><br>background: i'm mostly dynamically building component hierarchies.<br><br><br><br>here is what i would like to achive:<br><br>(defcomponent 'foo ()<br> ((comp-slot :accessor comp-slot-of :component nil)))<br><br>
(setf (comp-slot-of a-foo) (make-instance 'bar))<br><br>and then i would like to be able to use (call-component (comp-slot-of a-foo) (make-instance 'baz)) which requires that the place slot of bar is correctly set. i know i can do that by hand, but i would like it to ba done automatically.
<br><br><br><br>here is what i've tried in standard-component-class.lisp:<br><br>(defmethod (setf mopp:slot-value-using-class) (value<br> (class standard-component-class)<br> object
<br> (slot standard-component-effective-slot))<br> (call-next-method)<br> (when (slot-boundp slot 'component)<br> (format t "*** setting component slot ~A on object ~A to ~A~%" slot object value)
<br> (when value<br> (setf (component.place value)<br> (make-place (mopp:slot-value-using-class class object slot))))))<br><br>comments:<br> - maybe value and object should be dispatched on standard-component
<br> - the slot-boundp checking would not work in the current setup where the component slot of standard-component-effective-slot is set to nil<br><br>i hope it's a useful idea and someone with more knowledge picks it up,
<br><br>- attila<br><br>(alias 101 on irc &no 'its not lisp code :)<br><br>