@safe by default

Steven Schveighoffer schveiguy at yahoo.com
Sun Jun 17 11:54:21 UTC 2018


On 6/16/18 4:27 PM, Jacob Shtokolov wrote:
> On Saturday, 16 June 2018 at 18:47:10 UTC, Steven Schveighoffer wrote:
>> I would just caution that this does not affect member functions, only 
>> module-level functions. You have to repeat the @safe: inside any 
>> structs or classes as well.
> 
> Just tried that and it works very well (throws compilation errors): 
> https://gist.github.com/run-dlang/ba59bcca4464d875f95f975d13bebe88
> 
> It seems that it works even for member functions! But still not sure 
> about anonymous functions and delegates.

Hm... interesting!

I guess for @safe it works, but other attributes (nothrow, pure), it 
doesn't. I assumed all the attributes behaved the same, but apparently not.

-Steve




More information about the Digitalmars-d mailing list