Make IEx start even when some modules do not compile

35 views
Skip to first unread message

Mário Guimarães

unread,
Mar 31, 2020, 7:50:08 AM3/31/20
to elixir-lang-core
Hello,

I think it would be nice that when running

iex -S mix

IEx could be started even in the presence of modules with compilation errors, by loading only the modules with no errors.

Elixir would start IEx with only the modules that it could compile. Then, calling a compiled module would work as usual, but calling a module that could not compile would generate the typical "UndefinedFunctionError ... (module ... is not available)".

During compilation Elixir would delete the ".beam" file for the modules that could not compile, so they would not be loaded, thus generating the previous error if they are called (perhaps this deletion step is already done by the compiler, I don't know).

I think this feature has the virtue to reduce friction in the development workflow, by not forcing the developer to fix modules that won't be called in the IEx session.

Do you think this would be useful ?

Thanks
Mário Guimarães

José Valim

unread,
Mar 31, 2020, 8:22:38 AM3/31/20
to elixir-l...@googlegroups.com
"iex -S mix" also starts your application and it is very likely we won't be able to start your application, or it would behave poorly, if not all code has been compiled.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/fd5d8aff-0251-4893-a334-728a8b57cd2c%40googlegroups.com.

Mário Guimarães

unread,
Mar 31, 2020, 9:56:25 AM3/31/20
to elixir-lang-core
Is there a way to start IEx without starting the application, but only load the modules that compiled?

This could be enough, and be useful to test a couple of functions in which the developer is working on at the moment.


terça-feira, 31 de Março de 2020 às 13:22:38 UTC+1, José Valim escreveu:
"iex -S mix" also starts your application and it is very likely we won't be able to start your application, or it would behave poorly, if not all code has been compiled.

On Tue, Mar 31, 2020 at 1:50 PM Mário Guimarães <mario.lui...@gmail.com> wrote:
Hello,

I think it would be nice that when running

iex -S mix

IEx could be started even in the presence of modules with compilation errors, by loading only the modules with no errors.

Elixir would start IEx with only the modules that it could compile. Then, calling a compiled module would work as usual, but calling a module that could not compile would generate the typical "UndefinedFunctionError ... (module ... is not available)".

During compilation Elixir would delete the ".beam" file for the modules that could not compile, so they would not be loaded, thus generating the previous error if they are called (perhaps this deletion step is already done by the compiler, I don't know).

I think this feature has the virtue to reduce friction in the development workflow, by not forcing the developer to fix modules that won't be called in the IEx session.

Do you think this would be useful ?

Thanks
Mário Guimarães

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-l...@googlegroups.com.

J.H. Almeida

unread,
Mar 31, 2020, 10:03:21 AM3/31/20
to elixir-lang-core
Compilation failures are, from my perspective, a useful and convenient part of the development workflow. It's possible to only compile certain files that you would like to test by starting an iex session and using the `c/2` function.

https://hexdocs.pm/iex/IEx.Helpers.html#c/2

Mário Guimarães

unread,
Mar 31, 2020, 11:16:57 AM3/31/20
to elixir-lang-core
That will work, I believe, though it is not so much convenient in comparison to a way to compile everything that changed in the project and load only what did compile successfully. But thanks for reminding me about the `c/2` function.
Reply all
Reply to author
Forward
0 new messages