<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 27 Aug 2024 at 04:06, Timon Gehr via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 8/26/24 03:16, Manu wrote:<br>
> On Mon, 26 Aug 2024, 07:56 Timon Gehr via Digitalmars-d, <digitalmars- <br>
> <a href="mailto:d@puremagic.com" target="_blank">d@puremagic.com</a> <mailto:<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>>> wrote:<br>
> <br>
>     On 8/25/24 13:06, Dom DiSc wrote:<br>
>      ><br>
>      > But I fully agree, this should be replaced by true trusted<br>
>     blocks, the<br>
>      > sooner the better.<br>
> <br>
>     You cannot have a "trusted block". It just does not work. The interface<br>
>     to any trusted thing has to be clearly delineated.<br>
> <br>
> <br>
> Well it obviously does work in some sense, because it's the de facto <br>
> standard that people generally expect in numerous languages.<br>
> ...<br>
<br>
No, it's laid out differently.<br>
<br>
> People are going to have it one way or another; whether it's a <br>
> ridiculous hack like `()@trusted { ... }();` or otherwise. It's what <br>
> other languages with this sort of thing do.<br>
> ...<br>
<br>
No, e.g. Rust just does not distinguish trusted and untrusted safe <br>
functions.<br></blockquote><div><br></div><div>Rust does:</div><div><br></div><div>unsafe {</div><div>  my_unsafe_code;</div><div>}</div><div><br></div><div>Perfect.</div><div><br></div><div>In C#:</div><div><br></div><div>unsafe {</div><div>  my_unsafe_code;</div><div>}</div><div><br></div><div>Perfect.</div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> We don't have a better offering to motivate people to deviate from their <br>
> patterns.<br>
> <br>
> Resisting that degrades D.<br>
> <br>
<br>
It should not be called "trusted" then.<br></blockquote><div><br></div><div>
Absolutely, 100%.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Fundamentally, I agree on the substance (though probably, even better <br>
designs are possible). However, let's not invent another idiosyncratic <br>
keyword now.<br></blockquote><div><br></div><div>What 'another keyword' are you talking about?</div><div>I think the problem that you're pointing at here is that we're using `@trusted` as a hack as if it meant what we all want; `unsafe` as in other languages.</div><div>I understand that D's 'concept' is not quite like that, but nobody ever wanted the definition that D presents that I'm aware of, and all we want is an unsafe block.</div><div><br></div><div>I don't see any reason for @trusted... we only need @safe to invoke the escape analysis, and then the ability to write an unsafe block inside a function; which people are abusing the @trusted keyword to achieve. Why is the design we have better than the established designs?<br></div></div></div>