An important pull request: accessing shared affix for immutable data

tsbockman via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 12 16:49:47 PST 2016


On Friday, 12 February 2016 at 19:12:48 UTC, Andrei Alexandrescu 
wrote:
> * If the buffer is const, then the allocator must 
> conservatively assume it might have been immutable and 
> subsequently shared among threads. Therefore, several threads 
> may request the affix of the same buffer simultaneously. So it 
> returns a reference to a shared affix.

I understand the reasoning here, but I really dislike the idea of 
`const` as a de-optimization. However, given the way that const 
is used, I guess this wouldn't be much of a problem in practice 
provided that some form of borrowing or inc/dec pair elision is 
implemented.


More information about the Digitalmars-d mailing list