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

Arine arine123445128843 at gmail.com
Sat Mar 28 14:10:23 UTC 2020


On Friday, 27 March 2020 at 04:20:47 UTC, Mathias Lang wrote:
> And since exceptional claims calls for exceptional proof, I 
> wanted to check whether or not your libraries would be any 
> different. It took me less than 5 minutes to find this: 
> https://github.com/atilaneves/unit-threaded/issues/176

That's a good example of why @trusted is broken.

And guess what the "proper" solution is?

https://github.com/atilaneves/unit-threaded/commit/b7457d5d317a2eb1f2bbb2ece9a80f3b26b71600#diff-1e0b7d3d93f30ae83fa8d01f92dfd5aaR59

Unsafe blocks like from Rust (aka hacky @trusted lambda in D). 
The whole way @trusted works itself creates buggy unsafe code. 
You shouldn't be calling unsafe code from safe code, unless it is 
explicitly marked as unsafe.

Here in this case, the "proper" way to solve this problem is the 
harder uglier way to solve it. Is that the design philosophy that 
should be striven toward? I remember from the other thread Walter 
saying that syntax is ugly on purpose so as to be avoided. 
Funnily a lot of the times it's the proper way to solve the 
problem yet the syntax is still ugly because someone doesn't seem 
to understand why.


More information about the Digitalmars-d mailing list