Greenwashing

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat May 30 12:27:30 UTC 2020


On Thursday, 28 May 2020 at 22:43:29 UTC, Andrei Alexandrescu 
wrote:
> And that should be a breaking change. So all is good.
>
> Changing the regime of a function from nothrow to throw is 
> major.

Of course changing the regime of a function from nothrow to throw 
is major.  That will be the case whatever the default regime is.  
But the point I was making was about how default regime choice 
mixes with the requirement for breaking change.

The scenario imagined here is "What happens if a function is 
using the default regime by accident because the developer forgot 
to add an attribute to change it?"

If the default regime is 'throw', then one can switch a function 
from the default regime to its opposite, without breaking change.

If the default regime is 'nothrow', then changing from the 
default regime to its opposite is inherently a breaking change.

We can reasonably expect that it will be a common scenario for 
developers to just use the default and then realize later that 
wasn't intended.  So when picking a default regime, it might be a 
good idea to pick the default that allows switching away without 
breakage.

(The same argument has been advanced for final-by-default class 
methods, you may recall.)


More information about the Digitalmars-d mailing list