shared array?

Prudence via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 11 13:06:51 PDT 2015


On Friday, 11 September 2015 at 19:27:49 UTC, Adam D. Ruppe wrote:
> On Friday, 11 September 2015 at 17:29:47 UTC, Prudence wrote:
>> I don't care about "maybe" working. Since the array is hidden 
>> inside a class I can control who and how it is used and deal 
>> with the race conditions.
>
> You could use __gshared instead of shared. It means put it in 
> non-tls storage, just like shared, but the compiler will not 
> attempt to help you use it correctly; you're on your own for 
> synchronization, etc.
>
>> What I want is to be able to use Array so I don't have to rely 
>> on the GC.
>
> But, again, built-in slices do NOT rely on the GC. Only 
> specific methods on them do and you can use your own 
> implementation for them.

Really?

Can you back up this claim? Not saying your lying, I'd just like 
to know it's true for a fact?

Ho wan you use "specific methods"? Do you mean I do not use new 
to allocate and use malloc(more or less)?

In that case, am I not essentially just re-creating Array? 
Obviously I can write my own array type and I can even write my 
own compiler, but that's no that the point, is it?







More information about the Digitalmars-d-learn mailing list