Sharing in D

Steven Schveighoffer schveiguy at yahoo.com
Wed Jul 30 20:12:29 PDT 2008


"Walter Bright" wrote
> http://www.reddit.com/comments/6u7k0/sharing_in_d/

There are 2 problems I see with this scheme.

First, that the default is 'unshared'.  This is going to break a lot of 
existing code, and make peoples lives miserable who do not want to deal with 
unshared non-stack data.  I would hazard to guess that adopting this would 
cause a larger rift than const.

Second, the fact that you can't implicitly cast shared to unshared and vice 
versa.  It's going to make communication between both 'worlds' very error 
prone, as you will be required to cast for any call from one to the other. 
People will do this just to get their code to work, without thinking about 
the consequences.  Even those that do think about the consequences, can't 
have the compiler statically check the cast in either direction, so once you 
cast, you lose all the benefit.

I'd have to see solutions to these before I'd think it was a good idea.  Or 
else examples of how to avoid these problems.

-Steve 





More information about the Digitalmars-d mailing list