why can't I call const methods on shared objects?

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 11 04:36:16 PDT 2014


On Friday, 9 May 2014 at 21:37:37 UTC, Vlad Levenfeld wrote:
> Error: non-shared const method is not callable using a shared 
> mutable object
>
> Why not? If the method is const, it can't modify the object 
> anyway.

Because thread-safety isn't only a problem when writing to 
memory, reads must also be carefully dealt with.


More information about the Digitalmars-d-learn mailing list