Jan 10 · 1 min read

Thank you for reading and question.

1. recompile

The recompile is nothing but, it compiles the code again. The back end process involved was explained with an example.

From the docs of reompile , it only works if IEx is started with a Mix project, for example,iex -S mix.

Before compiling the code, it will stop the current application, and start it again afterwards.

Stopping applications are required so processes in the supervision tree won’t crash when code is upgraded multiple times without going through the proper hot-code swapping mechanism.

2. Coming to r(Modulle) .

It re-compiles the module source code. It reloads as many modules defined in the file and update its content in memory, but the original definition of the module came from the .beam at beginning remains unchanged.

The best examples is `typespecs`which are loaded from the .beam file . They are not loaded again.

I just used iex for explaining the basics of hot code swapping to visualize the changes. I planned in version #2 explaining about how to make releases using distillery and performing hot plugging of code. It is necessary to know some things before we take long step.

Glad if you take time and read about it.

Once again thanks for reading.


Written by


Wrong CODE takes U to the right BUG 🐞 coding, thoughts & ideas