Persistent list
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 16 07:01:01 PST 2015
On Monday, 16 November 2015 at 14:08:23 UTC, Atila Neves wrote:
> You described immutable, not const. If one thread has a const
> reference, it's entirely possible another thread has a mutable
> reference.
Only if it's shared, or you've screwed up with casting and ended
up with an object which is actually shared being treated as TLS.
A const, non-shared object can't possibly be mutated while you're
doing stuff to it unless that same code somehow has access to a
mutable reference to the same data. And in most cases
(particularly if you're using pure heavily), it won't have access
to any other references to the same data, so you can usually rely
on a const object not being mutated while you operate on it.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list