[self-interest] selfUnit

Jecel Assumpcao Jr jecel at merlintec.com
Thu Jun 13 21:55:04 UTC 2002

On Monday 10 June 2002 05:03, Thorsten Dittmar wrote:
> sUnit is heavily based on exception handling. It try to find out, if
> there is something similar to this in self and as far as I can say
> now, it is not.

There is no exception mechanism in Self, unfortunately, but at least 
some applications that need it can make use of the the 
'onNonLocalReturn:' and 'onReturn:' methods in traits block. Your case 
is far more complex.

> Of course it would be easily possible to implement
> something like this, but a system change like this was not my
> intention.

There is enough reflection in Self that it might be possible to do this 
without any VM changes, but it would probably be easier with help from 
the VM. In any case it might be a tricky project.

> So as an alternative I looked at the process model and found it
> useful for the requirements of sUnit: (send one test message after
> another to an object, catch all errors and count the errors, warning
> and successful calls)

That is how the user interface does things.

> [...] Using dynamic inheritance it can be exchanged by
>  scheduler inScheduler ifTrue: [scheduler abort: self] False:
> [_Yield: abortAction]
> What do you think about this. Do you know a easier solution?

This seems very reasonable. But since you know that you want this when 
creating the process it might be better to create a new process 
prototype, copy this method there and change it as you indicated it and 
then use this new prototype whenever creating a new process for a test.

Changing things to use dynamic inheritance might make things too slow.

-- Jecel

More information about the Self-interest mailing list