Why no mutable shared from uniqueness?

Quirin Schroll qs.il.paperinik at gmail.com
Wed Feb 11 12:26:47 UTC 2026


If a pure factory function returns an non-`shared`-type object, 
that type should be convertible to `shared` or am I mistaken?
Essentially, this should compile:
```d
int[] make() pure @safe;

void main() @safe
{
     shared xs = make();
}
```
Currently, only the conversion to `const shared` is enabled by 
uniqueness. I don’t understand that limitation, but I’m not sure 
I understand `shared` very well.


More information about the Digitalmars-d-learn mailing list