Hi everyone,
Here are two concerns about proposals B/C/D. Since the require+alias are necessary, it may make the code too verbose. For example, imagine you have a Phoenix context with this:
alias MyApp.Blog.{Post, Like, Comment}
If we make those modules private, we need to break them individually as:
require MyApp.Blog.Post, as: Post
require MyApp.Blog.Like, as: Like
require MyApp.Blog.Comment, as: Comment
Which is considerably more verbose.
The other concern is that invoking require (or use or import) on a module defined in the same project, the current module will stop compiling until the required module becomes available and then it resumes compilation. This implies two things:
-
It is not possible to have circular dependencies between private modules. Although circular dependencies are arguably a consequence of poor design, it still is a difference in behaviour;
-
And there is a chance that if you require too many modules, compilation may slow down, as we need to wait for the require modules to finish compilation;
Those issues can all happen today but they are not very common because we don’t rely on require and similar between modules in the same project that often. However, adding private modules may be enough to make those issues more common and apparent.
This is not enough to block proposals B/C/D but it adds extra concerns to the mentioned proposals.
Note that one possible solution to this problem is to introduce requirep or aliasp. But we are concerned that adding yet another modified (besides alias, import, require, and use) will add more confusion and complexity than help.






















