shared - i need it to be useful

NX nightmarex1337 at hotmail.com
Wed Oct 17 20:01:35 UTC 2018


I don't see any problem with this proposal as long as these 
points hold:

- Shared <-> Unshared is never implicit, either requiring an 
explicit cast (both ways) or having a language support which 
allows the conversion gracefully.
- Shared methods are called by compiler if the type is shared or 
if there is no unshared equivalent.
- Programmer needs to guarantee that shared -> unshared 
cast/conversion is thread-safe by hand; such as acquiring a lock, 
atomic operations...
- Programmer needs to guarantee that when unshared -> shared 
cast/conversion happens, data is not accessed through unshared 
reference during the lifetime of shared reference(s). Effectively 
this means a data needs to be treated as shared everywhere at the 
same time otherwise all things fall apart.


More information about the Digitalmars-d mailing list