Simplification of @trusted

IGotD- nise at nise.com
Wed Jun 16 17:20:25 UTC 2021


On Wednesday, 16 June 2021 at 16:32:01 UTC, GrimMaple wrote:
>
> It's already broken, so let's break it even more? :)

Yes, why not. @safe, @trusted, @system is one of the more bizarre 
things in D. It kind of remind me of protection rings 0-3 in the 
X86 ISA. Few use all of these rings and just use two of them in 
order to separate kernel from user code. They are just there 
consuming gates and power.

ImportC seems to make this even more confusing, what are 
functions imported with ImportC going to be designated? @safe, 
@trusted, @system? If they they are labelled @safe, then it's 
kind of a lie and the programmer is responsible for knowing which 
function is FFI and what is not. If it is @system, then we need 
trampoline functions in D for every function if you are going to 
call it from safe, which kind of defeats the purpose of ImportC. 
@trusted might be the middle road but it is like @safe.

@system blocks in my opinion is an improvement and we can do away 
with @trusted because what's the point with it.


More information about the Digitalmars-d mailing list