@trust is an encapsulation method, not an escape

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 09:28:08 PST 2015


On Friday, 6 February 2015 at 17:16:19 UTC, Andrei Alexandrescu 
wrote:
> On 2/6/15 8:40 AM, David Nadlinger wrote:
>> This still does not solve the template inference problem
>
> What is that?

See my reply to Tobias [1]. This seems to be the crux of our 
disagreement and/or misunderstanding, and is precisely the reason 
why I recommended you to try your hand at rewriting some of the 
std.array range algorithms yourself in the Bugzilla discussion. 
Let me know if the explanation in said post is not clear enough.

>> though, unless
>> you make it a "non- at trusted" block instead of requiring 
>> @safe-ty. And
>> then you'd end up with the—at least to my eyes—rather absurd 
>> situation
>> that a template function that is marked @trusted might 
>> actually end up
>> being @system.
>
> @trusted functions are @system.

I meant "@system" as in the part of the function type/API 
contract, not concerning the implementation. That is, a template 
function that is marked @trusted might not be able to be called 
from @safe code.

David


[1] 
http://forum.dlang.org/post/fwiivepmjfvqbxgagcrm@forum.dlang.org


More information about the Digitalmars-d mailing list