shared - i need it to be useful

12345swordy alexanderheistermann at gmail.com
Mon Oct 15 20:28:35 UTC 2018


On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote:
> If you write a lock-free queue for instance, and all the 
> methods are
> `shared` (ie, threadsafe), then under the current rules, you 
> can't
> interact with the object when it's not shared, and that's fairly
> useless.
Unless the compiler can show that it is ok to implicit/explicity 
convert the object to share without any unintended consequences. 
It should reject it.
It seems that the better solution would to implement a 
implicit/explict covertion system similar to c# conversion 
Operators
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/using-conversion-operators

But that itself requires an DIP itself.

-Alex




More information about the Digitalmars-d mailing list