Manu's `shared` vs the @trusted promise

Neia Neutuladh neia at ikeran.org
Tue Oct 23 15:37:48 UTC 2018


On Tue, 23 Oct 2018 10:31:25 +0000, Dukc wrote:

> On Monday, 22 October 2018 at 14:49:13 UTC, Nicholas Wilson wrote:
>> On Monday, 22 October 2018 at 11:24:27 UTC, Dukc wrote:
>>> [snip]
>>
>> For reading, its a size_t so can be done with atomics, writing OTOH is
>> a @property that calls a function to reallocate if ned be. Reallocation
>> obviously needs to be locked.
> 
> True, but I meant that the very concept of array having a length member
> violates the strong @trusted rule referred to by the theard author.
> That's because somebody could make a @safe function to the module
> defining an array that makes the array unsafe to use (If the array is a
> struct in DRuntime, that is. I'm not sure about that.).

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.


More information about the Digitalmars-d mailing list