[Cuis-dev] Enhancement proposal: Fail test when no assertion ran

Andres Valloud ten at smallinteger.com
Tue Apr 16 10:08:08 PDT 2024


On 4/16/24 7:56 AM, Hernán Wilkinson wrote:
> "You have no idea what subclasses of Error exist in the system when such
> assertions / handlers block run.  You have no idea what code somebody
> put in defaultAction."
> 
>   The defaultAction does not also know the subclasses of Error when it 
> was written.

This is not a serious argument, surely.  Anyone can put in a 
defaultAction where it is needed.

> "But now on: Error do: [...] breaks that functionality because explicit
> handlers stop default handlers from running"
> 
>   I think we have a different understanding of what defaultAction is. As 
> I understand it, it is a handler that is run if no other handler is 
> found. That is how Christophe Dony, an exceptions researcher and expert, 
> explains them also in the many papers he wrote.
>   So, based on that definition it is not a good idea to put in the 
> default action handling code that should always be executed. It is how 
> you explained above as step 2: 2.  "No on:do: handler.  Run the default 
> handler "

You think "default" here means that defaultAction is the handler for 
when users do not put in an explicit on:do: handler, as if that was its 
only purpose.  It is not, and I can tell you that because I talked and 
worked with the people that were there when our exception mechanism was 
created, for years.  The point is that you can use defaultAction...

	... to specify what the default action is, as its name indicates...

especially in cases where the default action is always the same.  I also 
provided you two examples, one of which was a use case communicated to 
me by the people I mentioned above in the first place.

That is how the *designers* of exceptions used the thing they created, 
irrespective of what somebody wrote in a paper perhaps decades later. 
Also please you do have actual citations?

> "What you are suggesting with that on: Error do: [...] business is to
> always stop looking for handlers between steps 1 and 2, and to
> substitute steps 2-5 with a universal handler that somehow will know how
> to handle everything."
> 
>   No, I've never suggested that.

You can say that if you like.  Nevertheless, in practice, that is 
exactly what happens.  Doing on: Error do: [...] blanket disables 
default handlers, and once more you have no idea what code people put there.

Andres.


More information about the Cuis-dev mailing list