On Friday, 6 February 2015 at 18:30:03 UTC, Zach the Mystic wrote:
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
}

Exactly. I think this addresses the concerns. If I read Walter's OP correctly, it's precisely the use of the word '@trusted' that he opposes, unless it's built into an interface like a function signature. Also, a @system block could be one statement long, if I'm not mistaken, in which case the above could look like:

@trusted void myfunc() {
//implicitly safe
...
@system auto ptr = cast(ubyte*)4;

//implicitly safe again
}

If this is a real solution, it's kind of exciting! :-)

Reply via email to