On Wed, 13 May 2009 23:44:32 -0400, Matt <[email protected]> wrote:
[from reddit]
There was just a post to reddit announcing that thread local storage
would be the default for global variables and that the 'shared'
qualifier would make this happen. What I can't find is a description
of typing rules surrounding 'shared'. From the discussion at reddit,
it sounded like 'shared' was intended to mean 'possibly shared', with
the implication that thread local objects can be treated as 'possibly
shared'.
The problem I see with this is that it implies that it is not safe to
assign one shared reference to another, because the former may actually
be thread local while the latter is actually global. This would seem to
make the "maybe shared" concept pretty useless. Is this not a
problem? Or if not, can someone clarify to me what the actual
semantics & typing rules are?
Thanks,
Matt
I'm posting Walter's reply from reddit:
WalterBright 4 points 6 hours ago[-]
You're right about the return types of accessors, though we plan to
address this. But if I may make some corrections, C++ has four versions
(none, const, volatile, and const volatile), while D has five (none,
const, immutable, shared, and shared const). The shared immutable is not
counted since is the same as immutable.
I don't see a place for "maybe shared" that isn't already handled by
simply "shared".