why can't I call const methods on shared objects?
Vlad Levenfeld via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon May 12 19:48:58 PDT 2014
@FreeSlave & John Colvin
Yes, I see your point. I could still get tearing on a read. So,
in the case of methods that I believe are safe (e.g. 1-line
@property getters) I'll just write a shared variadic function
template that uses (cast()this).foo(args) to forward to the
non-shared method... and in less-safe cases, I can just add some
synchronization code to the shared version.
Or maybe its safer to do it the other way around, i.e.
(cast(shared)this) and forward from non-shared to shared? There's
not yet any established best practices for this, are there?
More information about the Digitalmars-d-learn
mailing list