If you could make any changes to D, what would they look like?

Elronnd elronnd at elronnd.net
Fri Oct 22 04:34:35 UTC 2021


On Thursday, 21 October 2021 at 20:26:47 UTC, Sebastiaan Koppe 
wrote:
> Unique/Isolated; A way to declare or require that an object 
> (both struct and class) cannot have more than one reference.
>
> For instance, it is perfectly fine to move an AA across thread 
> boundaries if there is only one reference to it. But in the 
> general you can't because you can't proof there is.
>
> This touches on @live a bit, but @live is put on functions 
> whereas I want it on objects (class+structs).

It's the difference between linear types and uniqueness types.  
'Linear' is part of the api contract of the callee: it promises 
not to change the number of references to an object.  While 
'unique' is part of the api contract of the caller: it promises 
an object to which there is only one object.


More information about the Digitalmars-d mailing list