[phobos] phobos commit, revision 2164

Michel Fortin michel.fortin at michelf.com
Sat Nov 13 18:07:23 PST 2010


Le 2010-11-13 à 20:54, Don Clugston a écrit :

> That's not a bug in the spec. That's a bug in the compiler -- that
> shouldn't compile. Please change it to @trusted.

@trusted should make it compile, but that doesn't mean it is appropriate to make assumeUnique @trusted.

A trusted function should safely encapsulate the unsafe state, but assumeUnique is just a shortcut for a cast and it leaks the potentially unsafe state to the caller. There's nothing you can trust in assumeUnique, it's the caller that must be trusted to do the right thing. Thus, the caller should be the one marked @trusted.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the phobos mailing list