@trusted attribute should be replaced with @trusted blocks

IGotD- nise at nise.com
Wed Jan 15 19:27:42 UTC 2020


On Wednesday, 15 January 2020 at 14:30:02 UTC, Ogi wrote:
> Without @trusted the safety design will be much simpler to 
> grasp. Currently the are three vague keywords, complex rules on 
> which functions can call which and best practices on which 
> attribute you should choose.

I also don't understand what's the point with @trusted. Should it 
only be used as a trampoline for safe code into the unknown or 
"some holds allowed" like something in between @system and @safe. 
I find this highly confusing. It's like x86 protection rings 
(ring 0 - 3) where rings 1 - 2 are seldom used.

If you think about it @trusted is not necessary as you say that 
@trusted "must be manually verified", aka unsafe.

I think you should be allowed to call unsafe code from safe code 
and it is up to the programmer to check the code that they call 
and make an assessment on stability. @trusted call can call 
unsafe code further down the line so @trusted isn't that useful.

I might have misunderstood the point of @trusted totally and you 
can try to make me understand what's the point of it. I didn't 
find the documentation very helpful.


More information about the Digitalmars-d mailing list