On 9 April 2013 18:03, Dicebot <m.strashun@gmail.com> wrote:
On Tuesday, 9 April 2013 at 08:00:38 UTC, Manu wrote:
Errrm, only globals are shared by default.
Locals or allocated memory are not thread-local, can be passed wherever
they want, including other threads.

No, globals are also thread-local by default.

Sorry, that's what I meant, I typed the wrong thing >_<

Everything is.

Errrr, no?
Only globals are thread-local. Everything else is either stack or heap allocated.

And it was intended that all variables that are supposed to be shared by threads in any reference-based manner are marked by shared, so you can't get it without copying or casting shared away (undefined!).

Yes but that's ultimately useless. If sharing is undefined, and you can only use pass something to another thread via shared, then you basically can't use threads.
shared is facilitated by blind casting. And codegen (which doesn't know if something actually WAS shared or not) can't be assuming it wasn't.
I can't imagine a situation other than immutable where the compiler is able to presume __restrict in this way.

Well, have I mentioned that "shared" implementation is somewhat lacking in D now? :)

It's almost a cruel joke. I try not to show that to people when I show them D ;)