Manu's `shared` vs the @trusted promise

Nicholas Wilson iamthewilsonator at hotmail.com
Tue Oct 23 23:09:22 UTC 2018


On Tuesday, 23 October 2018 at 20:25:55 UTC, Timon Gehr wrote:
> On 23.10.18 17:37, Neia Neutuladh wrote:
>> Altering the length of a builtin array calls a runtime function
>> _d_arraysetlengthT to reallocate it. And they don't have a 
>> .tupleof
>> property. So builtin arrays are safe.
>> 
>
> What he is saying is, you could add some @safe code to the 
> druntime module that defines the dynamic array struct. Then, 
> within this code, DMD would consider independent assignments to 
> the length and ptr members @safe, even though this is not the 
> case. Therefore, @safe is broken in druntime.

I would have assumed that they would be behind @properties which 
would be not `shared` (so uncallable on shared slices), and their 
internal logic would be @trusted.


More information about the Digitalmars-d mailing list