[squeak-dev] Morphic equivalent of 'display: none'?

Stéphane Rollandin lecteur at zogotounga.net
Fri Apr 3 21:07:39 UTC 2020


>  > You could have such a "removed morph" temporarily #become: a 
> collapsed representation (like a flat invisible morph for a list item), 
> and then swap it back when you need it. I have used that pattern; 
> #become: is fast.
> 
> 
> Hm, this does not convince me. :-) #become: replaces all references to 
> the original morph. I could not access or modify any part of it during 
> it is collapsed, or I would need to deal with a second variable. This 
> feels like unnecessary metaprogramming.

True.

> 
>  > Oh, yes, please do not add any logic to #submorphs. It is a plain 
> array and a lot of things rely on this. You can implement a wrapper 
> Morph with all that logic, instead.
> 
> I may have expressed myself wrong - I would never override #submorphs, I 
> meant to introduce a second selector, #nonSkippedSubmorphs.

Hmm.. the name in itself is a code smell :)

> So your general advice is to introduce a special morph that supports 
> morph skipping? The disadvantages of this approach would the limitation 
> that you cannot skip morphs in any regular morphs such as MorphicModels, 
> RectangleMorphs etc. ... I would rather like to use a layout for this.

Yes, if you plan to use this skipping functionality transversaly over a 
range of already existing morphs, a layout is probably the way to go.

Stef


More information about the Squeak-dev mailing list