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

ag0aep6g anonymous at example.com
Thu Jan 2 13:21:17 UTC 2020


On 02.01.20 13:34, bachmeier wrote:
> On Thursday, 2 January 2020 at 12:23:54 UTC, ag0aep6g wrote:
[...]
> What compiler do you use? I always get error messages when I try to call 
> @system functions from @safe code.


Why would you suddenly be calling @system functions from @safe code?

If all functions in your call chain are currently not marked, then you 
mark them all as @system for the DIP, and the code compiles just as it 
used to.

If the calling function is currently marked as @safe but the called 
function isn't, then the chain already doesn't compile.


>> And legacy code should be treated as @system, not as @trusted.
> 
> Perfectly working legacy code should by default stop compiling?


Yes. And if you want your working unsafe program back, you have to add 
lots of @system attributes.

You might oppose the DIP on the grounds that that's too much hassle for 
too little gain. That's a reasonable position.

Treating all legacy code as @trusted (when it was clearly @system 
before) would not be reasonable, in my opinion.

All that said, you *can* slap `@trusted:` onto your modules, of course. 
You really shouldn't, but you can.


More information about the Digitalmars-d mailing list