On 2/6/2015 3:57 AM, Martin Krejcirik wrote:
If I understand it correctly, Walter is against adding trusted blocks (trusted
{...}) into @safe functions. But what about having safe blocks in @trusted
functions ?

int somefunc() @trusted
{
    int a = systemfunc();
    int b;

    @safe {
       b = safefunc(); // calling systemfunc() not allowed;
    }

    return a + b;
}

The problem is, again:

    @trusted code must have a safe interface

and with code blocks, there is no interface specified to them other than examining EVERY line of code in it.

The way interfaces are specified in D is to use functions.

Reply via email to