@trust is an encapsulation method, not an escape

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 13:42:05 PST 2015


On Friday, 6 February 2015 at 21:33:01 UTC, Walter Bright wrote:
> On 2/6/2015 10:58 AM, David Nadlinger wrote:
>> @trusted doesn't differ in meaning from @safe for API clients. 
>> Both mean that
>> you can call the function from @safe code, nothing more, 
>> nothing less. I hope we
>> agree on that.
>
> That is correct. @trusted is a statement about the 
> implementation of a function, not its interface.
>
> This suggests that @trusted should apply to blocks of code, not 
> function declarations. Pedantically, I think that would be 
> correct. But as we've seen in usage, this seductively makes for 
> easy incorrect usage of @trusted. Pragmatically, the language 
> should make it harder to write incorrect code.
>
> Hence, I view it as the best compromise to make @trusted also 
> apply only at the function level.

Please see this post:

http://forum.dlang.org/post/riphxcqazksykafumzcg@forum.dlang.org


More information about the Digitalmars-d mailing list