I can share non shared things?

gdelazzari giacky98.mail at gmail.com
Tue Jun 19 20:09:07 UTC 2018


So, let's say I have this code

https://run.dlang.io/is/CaMJjd

It doesn't compile, and that makes sense since myNotSharedObject 
is... not shared. So I can fix it by making the class shared and 
making a shared instance of it, like this

https://run.dlang.io/is/hoMFD1

And that's how shared is supposed to work, right? Cool, I like it.

But then I try this and... it compiles and runs?

https://run.dlang.io/is/mNQsH1

Or, even worse, even this compiles and runs 
https://run.dlang.io/is/oyzHcw

So, if I can share non-shared variables/objects/whatever, then 
what's the point of shared?


More information about the Digitalmars-d-learn mailing list