@trusted attribute should be replaced with @trusted blocks

ag0aep6g anonymous at example.com
Wed Jan 15 19:14:13 UTC 2020

On 15.01.20 19:41, Joseph Rushton Wakeling wrote:
> Well, apologies to Steven if I've misinterpreted his proposal. But what 
> I had in mind was that @safe would be able to call @trusted just as it 
> does now.
> So, put that together with what I wrote above, and you have something 
> that allows better validation of the internals of @trusted functions, 
> and still gives the user clarity about which functions are safe in their 
> own terms, and which are safe based on some programmer provided guarantees.

You're saying that an @safe function `f` is somehow more guaranteed to 
be safe than an @trusted function `g`, even though `f` may be calling 
`g`. I don't see how that makes sense.

R f(P params) @safe { return g(params); }
R g(P params) @trusted { /* ... whatever ... */ }

Any assumptions you have about `f` better also be true about `g`.

More information about the Digitalmars-d mailing list