@safe by default

Bastiaan Veelo Bastiaan at Veelo.net
Sat Jun 16 14:16:17 UTC 2018


On Saturday, 16 June 2018 at 14:02:36 UTC, Jacob Shtokolov wrote:
> On Saturday, 16 June 2018 at 13:57:48 UTC, Bastiaan Veelo wrote:
>> On Saturday, 16 June 2018 at 13:52:37 UTC, Jacob Shtokolov 
>> wrote:
>>> Is it possible to introduce a new parameter/flag to the 
>>> compiler, to force all functions be @safe by default on a 
>>> per-module basis?
>>>
>>> For example:
>>>
>>> ```
>>> module mymodule;
>>>
>>> pragma(safe);
>>
>> We already have that, and with even shorter syntax:
>>
>> ```
>> module mymodule;
>>
>> @safe:
>>
>> [...]
>> ```
>>
>> :-)
>
> OMG! Didn't know that! xD
>
> Thank you Bastiaan!

You're welcome! It could have been better documented probably, 
because I was just looking for it and still cannot find it. I 
remember having seen it so I'm quite sure it is in there 
somewhere. At least it could have been in 
https://dlang.org/articles/safed.html. Here is one reference from 
the forum: 
https://forum.dlang.org/post/nj73gp$1q3k$1@digitalmars.com

Ah, found it, at the very top of 
https://dlang.org/spec/attribute.html

Yeah, it can be made more obvious.


More information about the Digitalmars-d mailing list