On 7/26/15 9:11 AM, Dicebot wrote:
I remember doing something like that in druntime because of objects -
you can't override @safe method prototype with @trusted one.


But you can, at least now you can, maybe it's changed.

In answer to the original question, the given code is quite unnecessary. However, the @trusted moniker would appear in the docs instead of @safe. Perhaps that's the reason.

BTW, the reason to put @trusted islands is because you have fully encapsulated @trusted parts inside a function. If the implementation details of the islands leak out to the @safe code, you should have the entire function be trusted (@safe can only really be useful if the building blocks its using are also @safe or manually verified to be @safe). This is often difficult to prove, and code inside phobos/druntime was written at various stages of the "@trusted" philosophy. So you are bound to find inconsistencies.

IMO, that function simply should be marked trusted until it can be marked safe.

-Steve

Reply via email to