Malreddy Ankanna
1 min readJan 10, 2019

--

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.

https://medium.com/@blackode/how-to-perform-hot-code-swapping-using-distillery-2-a-live-demo-genserver-state-update-53d8344d9147

Once again thanks for reading.

--

--

Malreddy Ankanna
Malreddy Ankanna

Written by Malreddy Ankanna

Programmer & Writer, I write about coding, thoughts, ideas, personal musings, technical articles, and tutorials.https://bio.link/blackode

No responses yet