2 minutes | start a discussion
iEx (Elixir’s interactive shell) is pure dope! It helped bring my development efforts back to the “let’s play and see what happens” level. Since Elixir modules are stateless and made up of pure functions, reloading a module is as easy as calling
r MyModule inside iEx.
During development, I’d try to keep one module called
Scratch, etc, where I’d do the quick and dirty setting up of things. This scratch module would usually have one function only, called
run. This is what I call in iex. The rest I do in the respective modules, which I reload after every change.
At work, I get to work with Python a lot and one of the things I love there is iPython. It’s such a strong REPL that I would often try and get my hands dirty there, before formalizing into code/test. In Python module reloads are not always trivial, however. This is where Elixir’s functional, “share-nothing” nature steps up the game. It’s easy to reload modules that have essentially no state.