Need help with druntime PR 2838 (fix for issue 11725: aa.dup should return mutable copy)

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Oct 24 19:11:29 UTC 2019


https://github.com/dlang/druntime/pull/2838

Basically, the problem is that the new version of AA.dup returns a
mutable copy of an AA, but the compiler is not inferring uniqueness for
the return value so dup'ing an immutable AA (like int[int]) cannot
implicitly convert back to the original type.

I looked at .dup for arrays in object.d, and apparently there's some
kind of trick involving DIP25 that allows the compiler to infer
uniqueness (thereby implicit convertibility to the original type), but I
don't understand how it works or how/whether it can be applied to the AA
case.

Any ideas?


T

-- 
Век живи - век учись. А дураком помрёшь.


More information about the Digitalmars-d mailing list