On #ifError: considered harmful was Re: Set>>add:

Tim Olson tim at io.com
Wed Nov 13 13:56:33 UTC 2002


Stephan Rudlof <sr at evolgo.de> wrote:
| John Sarkela wrote:
| In the Squeak exception mechanism, it is 
| > never appropriate
| > to send the #ifError: message, nor is it appropriate to ever set a 
| > handler on Exception or
| > Error unless the handler passes the exception after intercept.
|
| Good to know *now* that there are design flaws: I'm somewhat surprised
not
| to find any warnings or comments about these issues in the image...
| 
| Just taken a look into the standard: there is no #ifError:, but
#ifCurtailed: !
| So using #ifError: is *not* portable (to give another argument to
avoid it).

Right.  Note that #error: / #ifError: were part of the old Squeak
exception mechanism that was in place prior to the addition of the TFEI
exception package.  Since there were many existing users of the old
exception handler, the #error: / #ifError: methods were re-written to
use the new exception mechanism.  I'm sure that most, if not all, of the
senders of these in the current image were pre-existing, but should be
cleaned up at some point.

There should be a method comment on the Object>>error: and
BlockContext>>ifError: methods saying that these methods are deprecated
and suggesting an appropriate replacement from the new exception
mechanism, so that new users of #error: / #ifError: aren't created.

	-- tim



More information about the Squeak-dev mailing list