Discussion Thread: DIP 1035-- at system Variables--Community Review Round 1

ag0aep6g anonymous at example.com
Wed Jun 17 16:12:15 UTC 2020


On Wednesday, 17 June 2020 at 15:54:13 UTC, Andrei Alexandrescu 
wrote:
> On 6/17/20 10:59 AM, ag0aep6g wrote:
>> On 17.06.20 16:27, Andrei Alexandrescu wrote:
>>> Not even close. The crux of the matter is that forgetting to 
>>> add @system to that variable makes @safe code do unsafe 
>>> things with no diagnostic for the compiler. That's a problem 
>>> with the safety system, regardless of the adoption of this 
>>> DIP. We can't say "@safe D code is safe, except of course if 
>>> you forget to insert @system on key variables, in which case 
>>> it won't be with no warning."
>> 
>> If you forget @system on a safety-critical variable, then an 
>> @trusted function that relies on it does not have a safe 
>> interface and is invalid.
>> 
>> We're saying "@safe D code is safe, except when you make a 
>> mistake in @trusted code".
>
> This has been the case before.

Exactly. You insinuated that the meaning of @safe would change 
with the DIP. It doesn't.

If you forget @system on a variable, you're no worse off than 
now. But if you remember to add it, you can write proper @trusted 
code. You practically can't do that at the moment.


More information about the Digitalmars-d mailing list