Making RCSlice and DIP74 work with const and immutable

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 1 09:03:46 PST 2015


On Sun, 01 Mar 2015 15:53:06 +0000, Marc Sch├╝tz wrote:

>> However, AFAICS, it comes with a serious problem. Immutable objects are
>> freely passable between threads, so surely an immutable RC object would
>> need atomic counting just like a shared RC object, but unlike shared,
>> immutable does not necessarily express the intent of sharing between
>> threads; the immutable RC object could easily be counting atomically
>> for nothing.
> 
> Argh! I didn't think about this. Any chance we can deprecate this
> behaviour? It's also an obstacle for the implementation of thread-local
> heaps.

but deprecating this is... illogical at best. immutable objects are 
immutable, so why can't i pass 'em to any thread? do you mean that i 
can't use `immutable string = "mystr";` in different threads without 
copying anymore?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150301/d4bad8f8/attachment.sig>


More information about the Digitalmars-d mailing list