[Bese-devel] :component slots and places idea/question

Attila Lendvai attila.lendvai at gmail.com
Sat Mar 11 13:55:26 UTC 2006


hi!

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.

unfortunately it didn't happen... :)

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).

background: i'm mostly dynamically building component hierarchies.



here is what i would like to achive:

(defcomponent 'foo ()
  ((comp-slot :accessor comp-slot-of :component nil)))

(setf (comp-slot-of a-foo) (make-instance 'bar))

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.



here is what i've tried in standard-component-class.lisp:

(defmethod (setf mopp:slot-value-using-class) (value
                                               (class
standard-component-class)
                                               object
                                               (slot
standard-component-effective-slot))
  (call-next-method)
  (when (slot-boundp slot 'component)
    (format t "*** setting component slot ~A on object ~A to ~A~%" slot
object value)
    (when value
      (setf (component.place value)
            (make-place (mopp:slot-value-using-class class object slot))))))

comments:
 - maybe value and object should be dispatched on standard-component
 - the slot-boundp checking would not work in the current setup where the
component slot of standard-component-effective-slot is set to nil

i hope it's a useful idea and someone with more knowledge picks it up,

- attila

(alias 101 on irc &no 'its not lisp code :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/bese-devel/attachments/20060311/a7e4de5f/attachment.html>


More information about the bese-devel mailing list