New Issue: Should the user be allowed to define and explicitly call a module-level 'init' function?

16760, “vasslitvinov”, “Should the user be allowed to define and explicitly call a module-level ‘init’ function?”, “2020-11-20T06:58:51Z”

Currently we disallow explicit calls to module deinit functions. Should we do the same for module init functions?

Furthermore, should module init functions be allowed at all, as we currently do not invoke them implicitly?

Module init functions are discussed in #5792
Remotely related issues:   #6726   #11445   https://github.com/chapel-lang/chapel/issues/13897#issuecomment-529994657

For example, this program compiles and prints “init”:

module M {
  proc init() {
    writeln("init");
  }
}
module Main {
  use M;
  proc main {
    init();
  }
}

If I comment out the call to init() in main(), init() will not be invoked.

We have at least these tests doing this as of this writing. I plan to rename their init functions soon:

test/modules/diten/moduleNotInitialized.chpl
test/modules/diten/moduleNotInitialized2.chpl