Am Mon, 12 Oct 2015 10:28:55 +0300 schrieb Andrei Alexandrescu <seewebsiteforem...@erdani.org>:
> On 10/12/15 7:19 AM, Jonathan M Davis wrote: > > On Monday, 12 October 2015 at 03:59:04 UTC, Marco Leise wrote: > >> Am Sun, 11 Oct 2015 07:32:26 +0000 > >> schrieb deadalnix <deadal...@gmail.com>: > >> > >>> In C++, you need to assume things are shared, and, as such, use > >>> thread safe inc/dec . That means compiler won't be able to optimize > >>> them. D can do better as sharedness is part of the type system. > >> > >> With the little nag that `shared` itself is not fleshed out. > > > > Well, it really should be better fleshed out, but the reality of the > > matter is that it actually works pretty well as it is. The problem is > > primarily that it's a pain to use - and to a certain extent, that's > > actually a good thing, but it does make it harder to use correctly. > > Yah, I'd like to make "finalizing the language" a priority going > forward, and finalizing shared is a big topic. It's hard to present to > the world a language with fuzzy corners. -- Andrei Wouldn't it be great if everyone took notes of the currently perceived shortcomings of shared so that there is a pile of use- and corner-cases to look at for a redesign? Then you would filter by valid use case and undesired usage and practically had everyone's input already under consideration when it hits the discussion forums. My own experience is what Jonathan describes. It is annoying in a good way. It makes you wait and think twice and more often than not you really attempted an illegal access on shared data. This went well up to a point when I had a component that held references to shared things. There is no such thing as a shared struct with shared fields in the type system. Once you share the outer struct, the inner stuff's shared status is merged with the outer and you can't cast it back to what it was before. So it works for plain integral types, but aggregates and what others mentioned about thread local GC heaps are my big question marks. -- Marco