I work on a library that has a helper module. In that module there are a few macros that are needed at compile time, but are completely useless at runtime. What’s more, the presence of that module is annoying because IEx brings it up when pushing the <tab>
key after MyApp.
. Is it somehow possible to have the MyApp.Utils
module at compile time but not have it at runtime?
It that’s not possible: can I just flag that module somehow that at least IEx will not bring it up as a possible completion?
I know I could put it outside the MyApp namespace but that is a bad practice, isn’t it? All modules should be named like MyApp.Something
.
Is it an option to put those in a .exs file? Just wondering.
That will not work, as you cannot load that file in a way that would prevent export of compiled byte code to .beam
file.
AFAIK the answer to both questions is no:
- It is not possible to define such module
- It is not possible to mark some module as “hidden”
Correct. You can hide modules from docs but not from IEx because that would make your own debugging and development experience harder.
2 Likes
You might want to rethink how you generate your code, I’ve long been using macros to generate code at compile time, which is great, now a days I turn to mix task to generate modules with the generated code, this also has the benefit of reducing compilation time.
1 Like