16715, “mppf”, “should list be assignable from a list of different but compatible type?”, “2020-11-16T19:25:31Z”
A list can only be initialized from a list of the same type right now. For example:
use List;
var int8List: list(int(8));
int8List.append(1);
var intList: list(int);
writeln(intList);
intList = int8List;
does not compile. But, it could compile if a proc =
is added that is slightly more general. The proc =
could check that the RHS eltType is coercible to the LHS eltType.
Should such a patterns be allowed?
Note that after PR #16708, such cases are allowed for copy initialization. Presumably we should allow them also for =
or prevent them for init=
.