Semantics of shared

Matt gelfmrogen at yahoo.com
Wed May 13 20:44:32 PDT 2009


[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







More information about the Digitalmars-d mailing list