Proposal: Private modules (general discussion)

It’s not going to work. This proposal is for something else. Look that as in Elixir core as in Elixir libraries there are lots of modules which are internal. They are required by other modules in library/project, but they should not be used outside it. Unfortunately at compiler level it’s not possible to determine in which app you are, so we can’t reserve specific module only for current app. Previously developers were just defined @moduledoc false, but lots of other developers (even those which maintain popular libraries) were still using API which was not documented. Such internal API could be changed basically at any commit. We are discussing here a way to not allow such cases.

From this module which is visible only in one file is not really usable. While it could be used it would cause creating a big file with even thousands of lines which contains probably most of modules. Here we want to keep already defined code, but (for example) just change some definitions i.e. defmodule MyLib.MyModule do … enddefmodulep MyLib.MyModule, visible_to: [MyLib] do … end. Similarly it goes for other proposals where (again for example) we want to add only one extra module attribute.