@trust is an encapsulation method, not an escape
Atila Neves via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 6 09:36:26 PST 2015
> I'm trying to promote suggesting '@system' blocks instead of
> '@trusted'. '@trusted' functions, but '@system' blocks - which
> can only go in @trusted functions (@system block in @system
> functions are redundant). It's the same semantics, but it might
> win the day because the intent is to isolate the @system code,
> while still presenting a @trusted interface, as seems so
> important to the leadership.
That might be better than using @safe inside @trusted:
@trusted void myfunc() {
//implicitly safe
...
@system { //wouldn't compile otherwise.
auto ptr = cast(ubyte*)4;
}
//implicitly safe again
}
More information about the Digitalmars-d
mailing list