Hacker News new | ask | show | jobs
by theonething 736 days ago
> killer feature is IEX, Elixir's REPL

Don't many other languages have this? Ruby has IRB for example. Is there anything IEX does that IRB doesn't?

3 comments

The cool thing is that you can, with the BEAM, connect your shell[0] to a running server and use something like recon_trace[1] to watch functions as they’re getting called. The same principle is used for libraries like this distributed profiler so you can watch the aggregate performance of your application[2].

[0] https://hexdocs.pm/iex/1.12/IEx.html#module-remote-shells (the remsh flag)

[1] https://ferd.github.io/recon/recon_trace.html

[2] https://hexdocs.pm/orion/Orion.html

Not just a running server, you can hook into a running cluster and do such things.

The Observer, :observer.start(), is another very nice tool. Might require some widget libraries for the GUI but you'll likely have set that up on the machine you're doing the introspection from.

This was possible with various flavors of Pry and DRB once upon a time.
Beam/OTP has a lot of tools for understanding the runtime state of the system. And you can attach the REPL to an existing, already running instance.

As with many things Elixir/Erlang related, there isn't a lot that's unique and not seen anywhere else. It's more that the pieces are carefully thought through and come together to make a fantastic whole.

Personally, I prefer iex over irb, iex feels more intuitive. Recently, some improvements were made into iex, the most relevant to me is the ability to use Ctrl+l to clean the output. Now, iex is getting closer to ipython.