@trusted considered harmful
David Piepgrass
qwertie256 at gmail.com
Fri Jul 27 19:31:55 PDT 2012
> I don't see flaw with 1.
>
> However 2 doesn't sound right.
>
> @trusted {
> // Do something dirty.
> }
>
> You aren't supposed to do dirty things in @trusted code. You're
> supposed to safely wrap a system function to be usable by a
> safe function. The system function is supposed to be short and
> getting its hands dirty.
True, but since the proposal is that all functions should be
either @safe or @system, a @trusted block is necessary in a @safe
function in order to call @system functions. Perhaps you would
suggest that a @trusted block should be able to _call_ @system
code but not actually do anything unsafe directly? That sounds
interesting, but it's not how @trusted currently works.
More information about the Digitalmars-d
mailing list