Justwerk compiler flag

Ogion ogion.art at gmail.com
Sun Jul 27 11:08:30 UTC 2025


On Saturday, 19 July 2025 at 23:48:22 UTC, Kapendev wrote:
> Yeah, that's annoying, but it depends on the library. Some 
> stuff might benefit from this constraint.

Sure, but it would be nice if the library user could opt-out of 
these constraints.

> And worse case, you just cast and then you are done.

No, you really can’t. The second you forcefully pass, say, unsafe 
function to a library, the *whole library* becomes potentially 
unsafe, not just the function that receives callback.

```D
module library;

void function() @safe callback;

void addCallback(void function() @safe cb) @safe {
     callback = cb;
}

void callCallback() @safe => callback();
```

So you it’s not correct to opt-out of constrains at function 
level. It should be done globally.



More information about the dip.ideas mailing list