DIP1028 - Rationale for accepting as is

Steven Schveighoffer schveiguy at gmail.com
Fri May 22 16:47:34 UTC 2020


On 5/22/20 12:39 PM, jmh530 wrote:
> On Friday, 22 May 2020 at 16:03:00 UTC, Steven Schveighoffer wrote:
>> [snip]
>>
> 
> Fortunately, the above point can be more easily fixed by making `free` 
> @system, which will then require annotating every subsequent piece of 
> code that touches it. It's annoying transition, but it's do-able.

You can't, you don't control that code, someone else does (this is 
important, you can declare extern(C) functions anywhere, even locally).

And from the experience of .save for forward ranges, people just aren't 
going to do this. They are going to do the easiest thing that works 
without complaint -- i.e. don't bother marking.

> That `static if` thing just looks like a nightmare, but I think the 
> point still applies that you will get error messages if the body is 
> available and you try to do something that isn't @safe.

It essentially is a "best effort" at calling the right thing. The code 
compiles either way, and be @safe either way, but will do the unsafe 
thing when it really should do the safe thing. It's ACTIVELY trying to 
ensure safety, but the compiler will thwart it.

-Steve


More information about the Digitalmars-d-announce mailing list