nothrow by default

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jan 6 08:02:43 UTC 2020


On Monday, 6 January 2020 at 06:58:34 UTC, Paul Backus wrote:
> `nothrow` by default doesn't stop you from using exceptions, it 
> just forces you to either catch them or mark your function as 
> throwing.

It kinda does: generic programming.

Say if I want to do critical math and create a numeric class that 
throws on inaccuracies. Then I cannot use libraries that "forgot" 
to add "throws" because whenever I provide a lambda that use 
critical math those libraries will refuse to take them.

Attributes like "nothrow" should be for public APIs.  For most 
code is better to do this using semantic analysis.



More information about the Digitalmars-d mailing list