Robert Jacques Wrote: > On Sun, 13 Sep 2009 18:08:57 -0400, Jeremie Pelletier <jerem...@gmail.com> > wrote: > . > > Bartosz took the concept one step further: when declared as shared, all > methods are implicitly wrapped in synchronize blocks. He then added a > keyword for more manual, lock-free style programming. But this syntactic > sugar isn't implemented yet. >
That is not the design for D2. shared means shared. It is neither meant to mean synchronized nor lockfree. I worry about optimization opportunities for shared in D2. There may be way too many memory fences in synchronized code. Without a mapping of a monitor to what's protected under a monitor, the compiler/optimizer's hands are tied. At best, every object will be its own monitor, but that hardly makes any sense...