Is synchronized(...){...} doomed to never be nothrow/@nogc?

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Wed May 11 07:22:39 PDT 2016


On Wednesday, 11 May 2016 at 14:12:47 UTC, Jonathan M Davis wrote:
> Regardless of the desirability of marking stuff with nothrow, 
> one _huge_ difference between nothrow and pure or @nogc is that 
> it's trivial to use a function that throws inside of nothrow 
> code by wrapping it in a try-catch block. @safe is in a similar 
> boat thanks to @trusted, but pure and @nogc can only be gotten 
> around via some nasty casts.

It doesn't apply if throwing is desired as part of API, which is 
exactly the case for monitor and issue I had before with adding 
nothrow to some Fiber methods.


More information about the Digitalmars-d mailing list