16320, “vasslitvinov”, “Should private functions be visible through POI ?”, “2020-09-02T00:19:18Z”
Consider the following code, which relies on the POI (Point of Instantiation) rule in the spec:
module Lib {
proc libfn(param p) {
pubFn(); // invoke through POI
privFn(); // invoke through POI
}
}
module User {
public proc pubFn() { compilerWarning("pubFn", 1); }
private proc privFn() { compilerWarning("privFn", 1); }
proc main() {
use Lib;
libfn(0);
compilerError("done",0);
}
}
should the call to privFn
in Lib.libfn resolve?
Arguments in favor:
- The POI rule requires the target function to be visible from the call site. Private functions ARE visible.
- The current plan for Constrained Generics allows an interface function to be implemented with a private function.
Arguments against:
- We can interpret
private
as prohibiting this use.