On Sunday, 15 February 2026 at 21:20:12 UTC, Timon Gehr wrote:
On 2/11/26 13:26, Quirin Schroll wrote:
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.
`const shared` works because it is a supertype of `immutable`
and `immutable` works. Even that existing rule is perhaps
unsound (depending on what you consider to be the intended
semantics of `shared`):
https://forum.dlang.org/post/[email protected]
Basically the issue is that you will have unsynchronized memory
writes to some locations that later get transitively typed as
`shared`.
That thread is very interesting. Thanks.