RFC: Change what assert does on error

Dukc ajieskola at gmail.com
Tue Jul 8 19:33:34 UTC 2025


On Tuesday, 8 July 2025 at 19:18:39 UTC, Richard (Rikki) Andrew 
Cattermole wrote:

> Right now it is contributing to the belief that Error will not 
> run cleanup. Which isn't true. It does.

Either interpretation is wrong. It is currently _unspecified_ 
whether `Error` will run cleanups, unless it is explicitly caught.

Or maybe I should write "undetermined", as I don't think the spec 
actually covers this. But I believe that is the intent behind 
what it currently does.

> Right, a nothrow specific optimization to me would mean that a 
> function is marked as nothrow and therefore an optimization 
> takes place because of it. The attribute comes before the 
> optimization.
>
> That isn't what is happening here. The compiler is going 
> statement by statement, looking to see if in the execution of 
> that statement it could return via an Exception exception and 
> then when not present simplifying the AST. The attribute is 
> coming after the optimization.

Nonetheless, the presence of `nothrow` attribute on a called 
function is affecting what is happening. I believe this is what 
everyone else here means with `nothrow` optimisation, no more, no 
less.




More information about the Digitalmars-d mailing list