shared - i need it to be useful

Timon Gehr timon.gehr at gmx.ch
Wed Oct 17 13:10:09 UTC 2018


On 17.10.2018 14:24, Timon Gehr wrote:
> and unshared methods are only allowed to access unshared members.

This is actually not necessary, let me reformulate:

You want:

- if you have a C c and a shared(C) s, typeof(s.x) == typeof(c.x).
- shared methods are not allowed to access unshared members.
- shared is not transitive, and therefore unshared class references 
implicitly convert to shared class references

Applied to pointers, this would mean that you can implicitly convert 
int* -> shared(int*), but not shared(int*)->int*, int* -> shared(int)* 
or shared(int)* -> int*. shared(int*) and shared(shared(int)*) would be 
different types, such that shared(int*) cannot be dereferenced but 
shared(shared(int)*) can.


More information about the Digitalmars-d mailing list