Morphs & Models question

Kevin Fisher kgf at golden.net
Thu Oct 11 12:15:56 UTC 2001


Hi:

Something occurred to me the other night while I was reading the "white book"
section on models.

As things are right now, if you have a Model that displays a Morph of some
kind, the "proper" way to notify the Model about the deletion of the Morph
is to have the Morph send windowIsClosing to the Model.

Is it unreasonable to think that this could be done better with the
dependency mechanism instead?  For example, when the Model creates
the Morph, the Morph adds the Model to it's own dependency list.
When the Morph is deleted, it sends "self changed: #windowIsClosing", which
the Model receives in the #update: method.

Of course, I did a quick example to try this out and it didn't quite work
as I expected...it seems that without a reference to the Model in the Morph
object, the Model gets GC'd away and the "self changed: #windowIsClosing"
sent by the Morph doesn't get acknowledged by anything.  However, if
I open the Model in an inspector this system works perfectly (since the
inspector keeps the Model from getting GC'd, I assume).

Anyway, does this totally play havoc with the whole "Morphs and Models" scheme
that replaces MVC? 

Just a thought...





More information about the Squeak-dev mailing list