DIP 1028---Make @safe the Default---Community Review Round 1

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 3 15:38:02 UTC 2020

On 1/2/20 12:38 PM, H. S. Teoh wrote:
> On Thu, Jan 02, 2020 at 05:27:22PM +0000, Arine via Digitalmars-d wrote:
>>>   Fortunately, the solution is easy, although tedious: annotate
>>>   functions that aren't safe with @trusted or @system.
>> If you could annotate the module with @system to use the old behavior,
>> this will ease the transition period. This is better than simply
>> having a compiler flag that changes behavior, as you can see in the
>> code that is using the old behavior. You can also disable it per
>> module, not either on or off for everything.
>>      @system module std.stdio; // or similar
> You can already do this today:
> 	module blah;
> 	@system:
> 	... // everything here defaults to @system
> Of course, today this does nothing because @system is the default, but
> you can already mark an entire module as @safe the same way, for
> example.

This is erroneous. It marks all templates @system, which would otherwise 
be inferred @safe.

And it does not mark member functions.

I think the idea of marking a module @system is good, but the usage is 
confusing. What you want to affect is the *default* assumption.

You need a pragma.


More information about the Digitalmars-d mailing list