[Bese-devel] Re: UCW beginners error; it.bese.ucw::place is unbound

Marco Baringer mb at bese.it
Fri Feb 17 13:14:52 UTC 2006


Matthew Danish wrote:

> What this achieves is that by using :COMPONENT it automatically sets up
> the PLACE and PARENT slots of MY-MODULE-CHOICE.  You could do this
> without :COMPONENT by doing something like:
> 
> (defmethod initialize-instance :after 
>       ((c my-simple-window-component) &rest initargs)
>   (declare (ignore initargs))
>   (setf (body c) (make-instance 'my-module-choice
>                                 :place (make-place (body c)) :parent c)))
> 
> I'm no expert, but I'm pretty sure this is all :COMPONENT ends up doing
> anyhow.  Note that MAKE-PLACE is a macro which accepts a form as
> argument, that form being the code which accesses the ``place'' of the
> object (in SETF terminology).

exactly.

a (:component foo :bar 42) initarg is equivalent to writing:

:initform (make-instance 'foo :bar 42 :place (make-place (slot-value
self 'name-of-slot))

except that, should you ever explictily pass an initarg for that slot,
standard-component class will setup the place automatically.

that doesn't make a lot of sense does it? example:

(defcomponent foo ()
  ((body :component (some-component))))

(call 'foo) will put a some-component instance in the body slot.

(call 'foo :body (make-instance 'chooser))

will put a chooser instance in the foo slot _and_ setup the place and
parent slots of the newly created chooser.

> Now when you use CALL-COMPONENT, there is a PLACE slot in the old
> component for it to bind to the new component.

hth.
-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the bese-devel mailing list