TLBB: The Last Big Breakage

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Mar 15 21:08:18 PDT 2014


D1's approach to multithreading was wanting. D2 executed a big departure 
from that with the shared qualifier and the default-thread-local 
approach to data.

We think this is a win, but D2 inherited a lot of D1's thread-related 
behavior by default, and some of the rules introduced by TDPL 
(http://goo.gl/9gtH0g) remained in the "I have a dream" stage.

Fixing that has not gained focus until recently, when e.g. 
https://github.com/D-Programming-Language/dmd/pull/3067 has come about. 
There is other more stringent control of shared members, e.g. 
"synchronized" is all or none, "synchronized" only makes direct member 
variables unshared, and more.

This will statically break code. It will refuse to compile code that is 
incorrect, but also plenty of code that is correct; the compiler will 
demand extra guarantees from user code, be they in the form of casts and 
stated assumptions.

I believe this is a bridge we do need to cross. One question is how we 
go about it: all at once, or gradually?


Andrei



More information about the Digitalmars-d mailing list