[Pharo-dev] Catching Exceptions without any notice

Henrik Nergaard henrik.nergaard at uia.no
Fri Apr 1 18:13:57 EDT 2016


>Purpose of that catch, as mentioned by Nicolai, is indeed to ignore late initialized objects. For example, imagine a Morph with height that is equal to >owner's height. In this case one would write in #initialize:

>Initialize

>  self height: [ :morph | morph owner height ].

No.

ownerChanged

self height: owner height.

…………..

One should not rely on the owner being set during initialization (90% of the time at least), it makes morphs too reliant on certain cases, which makes them harder to use/understand.

If the morph must have an owner to operate properly, it loses many of its abilities such as being its own root, for example to make images.

ThatMorph new exportAsPng.



Best regards,

Henrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20160401/c404418f/attachment.html>


More information about the Pharo-dev mailing list