Discussion Thread: DIP 1028--Make @safe the Default--Final Review

Arafel er.krali at gmail.com
Sun Apr 5 10:06:52 UTC 2020


On 5/4/20 11:50, Arafel wrote:
> But then, wouldn't that be an argument to assume everywhere @trusted by 
> default? If the user is responsible for marking non-trusted function 
> declarations, why not do the same for non-trusted function definitions?
> 
> Just assume that all function bodies are safe, and ask the user to slap 
> @system on those who aren't!
> 
> Isn't that an inconsistency as well?

To expand on this final point, I think it's quite important. Consider this:

```d
extern(C) void foo(); /* assumed @safe, or more properly, @trusted- */
extern(C) void bar() { } /* assumed @system, why not @trusted as well? */

void main() @safe {
     foo(); // OK: Here we assume the user verified the function
     bar(); // ERROR: Here we don't!!
}
```

Don't you find this inconsistent and confusing? For sure I do.

A.


More information about the Digitalmars-d mailing list