Discussion Thread: DIP 1028--Make @safe the Default--Final Review

Mathias Lang pro.mathias.lang at gmail.com
Fri Mar 27 03:44:49 UTC 2020


On Friday, 27 March 2020 at 02:35:56 UTC, Vladimir Panteleev 
wrote:
> On Friday, 27 March 2020 at 02:31:13 UTC, Vladimir Panteleev 
> wrote:
>> This applies to extern(D) declarations, too. Effectively, this 
>> would mean that functions with a body won't need a @safe 
>> annotation, but functions without a body will require it. 
>> However, I think this is a more correct solution despite this 
>> issue.
>
> An afterthought. Because safety is part of D mangling, 
> body-less extern(D) declarations could be assumed to be @safe. 
> A mismatch (assumption of @safe but a @system implementation) 
> will result in a linker error.
>
> This applies to all mangling schemes which can represent @safe, 
> which is only extern(D) at the moment. So, if any calling 
> convention would be special in this regard, it would be 
> extern(D).

Linker error are some of the most unfriendly way to do diagnostic.
Having all declarations without definitions needing to be 
explicitly annotated is IMO much better.
There aren't that many places out there where such a pattern is 
used anyway.


More information about the Digitalmars-d mailing list