shared - i need it to be useful

Stanislav Blinov stanislav.blinov at gmail.com
Tue Oct 23 12:35:56 UTC 2018


On Tuesday, 23 October 2018 at 01:26:57 UTC, Neia Neutuladh wrote:

> Somehow I lost track of your reason behind the promotion.
>
> Why not just ask to be able to call shared methods on a 
> thread-local variable? No implicit casting; you need to take 
> positive action to share anything. And if there's a non-shared 
> overload, that's still preferred.

Because these have the same signature:

struct S {
     void method() shared;
}

void func(ref shared S zis);

i.e. calling a shared method on a thread-local variable does 
require an implicit cast of the 'this' reference. Just like 
calling a 'const' method.


More information about the Digitalmars-d mailing list