[cells-devel] observers

Ken Tilton kennytilton at optonline.net
Tue Mar 18 00:26:45 UTC 2008


Andy Chambers wrote:
> Two questions...
> 
> 1) What's the best way to remove an observer that's been set on some slot?

My ide offers a gui display of all methods on a GF, in this case the gf 
being slot-value-observe. If I am feeling energetic I use that to hunt 
down the specific method and then (using the same gui) remove the method.

If I am not feeling energetic I delete the body of the one I want to 
lose, recompile so it still runs but does nothing, then delete 
altogether so on the next load from scratch it is fully gone.

> 
> 2) If there's an observer like
> 
> (defobserver image-files ((self widget))
>   (loop for (name file-pathname) in (set-difference new-value
> old-value :key 'car)
>       do (tk-format `(:pre-make-tk  ,self)
>            "image create photo ~(~a.~a~) -file {~a} -height ~a -width ~a"
>            (^path) name (namestring file-pathname)
>            (^height)(^width))))
> 
> ....can I make one that specializes on a subclass of widget that
> overrides the first?  How does one do this?

No. Observers are progn in any lisp that supports progn method combination.

To get the desired effect, have one observer redispatch to another GF 
(perhaps observe-widget-image-files) and then use classic method combo 
for that and tailor functionality the old-fashioned way.

kenny



More information about the cells-devel mailing list