Most basic nothrow, pure, @safe functions?

Sean Kelly sean at invisibleduck.org
Thu Mar 20 08:44:07 PDT 2014


On Tuesday, 18 March 2014 at 23:56:15 UTC, Steven Schveighoffer 
wrote:
> On Tue, 18 Mar 2014 19:48:45 -0400, Walter Bright 
> <newshound2 at digitalmars.com> wrote:
>
>> On 3/18/2014 4:20 PM, Steven Schveighoffer wrote:
>>> In a recent (well, recently pulled anyway) pull request that 
>>> Monarch Dodra
>>> brought up, we debated what should be considered nothrow in 
>>> the depths of druntime.
>>
>> There's a lot of low hanging nothrow fruit in druntime that 
>> doesn't need analysis, it just needs to get done:
>>
>> https://d.puremagic.com/issues/show_bug.cgi?id=12389
>
> Can we mark _d_monitorenter and _d_monitorexit nothrow and have 
> the compiler see that when using synchronized? This was the 
> hurdle we couldn't overcome in the referenced pull request.
>
> Should those be marked nothrow? What about pure and @safe?

I'd be inclined to say yes.  Although monitors use lazy 
initialization, I think the failure to initialize a monitor 
should probably be considered an Error.


More information about the Digitalmars-d mailing list