A side related question.
I wonder, when you have more instance variable referencing the same
object, does it make more difficult to get unused object garbage
collected?
In DrGeo I *fell* I have this kind of problem with object referenced
in other object and vis-versa, then never garbage collected. Or did I
miss something?

Hilaire

2008/8/17 Stéphane Ducasse <[EMAIL PROTECTED]>:
> Hello guys
>
> We were browsing code with marcus and I realized something quite funny about
> Morphic.
> Morphic is somehow close to seaside for the following point:
>
> There is a list that contains the children. In Seaside you have to return a
> list containing the children
> components too. Now this is really interesting to see that a lot of
> complexity in Morphic code
> comes from the fact that the programmers avoided to have an instance
> variable for an element
> to the pretext that the element was already in the submorphs list.
>
> Then you end up with code like
>
> label: aString
>
>        | oldLabel m |
>        (oldLabel := self findA: StringMorph)
>                ifNotNil: [oldLabel delete].
>        m := StringMorph contents: aString font: TextStyle defaultFont.
>        self extent: m extent + (borderWidth + 6).
>        m position: self center - (m extent // 2).
>        self addMorph: m.
>        m lock
>
> label
>        | s |
>        s := ''.
>        self allMorphsDo: [:m | (m isKindOf: StringMorph) ifTrue: [s := m
> contents]].
>        ^ s
>
> instead of
>
> label
>        ^ label
>
> label: aString
>
>        ....
>
> where you have to query the submorph of the right kind....
>
> Marcus was mentioning to me that Morphic is a bit like applying
> GraphTraversal that the law of demeter
> guy loves so much. And we see the results, an ugly code all over the places.
>
> So I will certainly play a bit with this design difference to see what it
> makes. But I'm sure now it makes a big difference.
>
> stef
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
http://blog.ofset.org/hilaire

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to