New Issue: should 'new R(arg)' be able to run a 'proc init=' ?

17199, "mppf", "should 'new R(arg)' be able to run a 'proc init=' ?", "2021-02-19T18:30:03Z"

Today we have several data structures in the modules that implement both proc init(rhs: rhsType) and proc init=(rhs: rhsType) for a variety of rhsType types. For example, there are these two functions implementing initialization of a list from a range :

It seems to be unfortunate that these initializers need to be repeated. So, this issue asks two questions:

  1. Should it be possible to implement one of these by calling the other? Does it work today to implement init= by calling init? Could we make it possible to implement init by calling init= ? Note that even if simple cases work here, init and init= have different strategies for instantiated or partially instantiated types (init uses additional arguments while init= uses this.type). Do we need some of the strategies from tertiary initializers to do this? (TODO tertiary initializers issue).
  2. Should the compiler automatically enable code like new list(myRange) to run list.init=(rhs: range) if no suitable list.init is available? This question is related to the question of whether or not the compiler can use an init= with an appropriate different type RHS to implement a cast. (TODO cast issue).