On Tuesday, October 08, 2013 20:46:16 Andrei Alexandrescu wrote: > On 10/8/13 8:31 PM, Walter Bright wrote: > > On 10/8/2013 8:18 PM, deadalnix wrote: > >> We also badly need to be able to use type qualifier. We must > >> stop the world when collecting thread local data or immutable one. > >> That do not > >> make any sense. > > > > Making this work is fraught with difficulty. It is normal behavior in D > > to create local data with new(), build a data structure, and then cast > > it to shared so it can be transferred to another thread. > > Stop right there. NO. That is NOT normal behavior, and if we require it > in order to work we have made a mistake. > > There should be NO casting required to get work done in client code.
Except that for the most part, that's the only way that immutable objects can be created - particularly if you're talking about arrays or AAs. It's _very_ common to do what Walter is describing. On top of that, we're forced to cast to immutable or shared to pass anything via std.concurrency, which causes pretty much the same problem. We're not even vaguely set up at this point to have type qualifiers indicate how something was constructed or what thread it comes from. - Jonathan M Davis