@trusted AKA most useless statement ever

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 25 06:43:45 PST 2016


On Friday, 25 November 2016 at 10:14:46 UTC, Satoshi wrote:
> but writing 20 times something like:
> auto vi = (() @trusted => glXChooseXFBConfig(...))();

That's an anti-pattern and you should almost never actually do 
it. That is breaking the trusted thing, and is not what the blog 
means when it says keep the functions as small as possible.

> just forced me to mark whole class with @trusted...

If the class encapsulates unsafe activity into some kind of safe 
interface, that's what you are *supposed* to do.


More information about the Digitalmars-d mailing list