Alex321
How to leave out modules at runtime?
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.
Marked As Solved
hauleth
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”
Also Liked
josevalim
Correct. You can hide modules from docs but not from IEx because that would make your own debugging and development experience harder.
Schultzer
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








