[Pharo-dev] Catching Exceptions without any notice
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:
> self height: [ :morph | morph owner height ].
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev