[dmd-concurrency] What is shared?

Jason House jason.james.house at gmail.com
Sun Jan 3 12:11:56 PST 2010


On digitalmars.D, I've seen a lot of confusion about how shared should/ 
does work. I don't know of any formal documentation on this. Maybe  
that'd be a side goal for this list?

Certainly, shared is transitive just like const or immutable. Non- 
shared instances can't call shared functions and shared instances can  
only call shared functions.

I know of at least one exception to that: auto x = new shared(T)();  
will call T's this() which is can not be marked as shared (bugzilla  
3640). I'm not sure about other special functions. It also isn't  
possible to have both a shared and a non-shared version of template  
functions (bugzilla 3660). 3660 has stopped my use of shared dead in  
its tracks.

While I'm listing bugzilla stuff, 3642's awful error message seems  
relevent. When that message shows up more meaningful scenarios there  
are other more helpful error messages that are also printed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-concurrency/attachments/20100103/4690209a/attachment.htm>


More information about the dmd-concurrency mailing list