News for hackers. Stuff that matters.
Re:Three Ways to Debug Code in Elixir by ketzo on Saturday December 04, 2021 @02:04PM (#29443386)
It can’t be emphasized enough how good IEx is.

Maybe it’s because it is my first experience with a language like Elixir, but man, it just feels like I’m living inside the program while it’s running in a way that an IDE debugger doesn’t. It’s so cool and so powerful.

Re:Three Ways to Debug Code in Elixir by marcus_cemes on Saturday December 04, 2021 @03:12PM (#29443896)
I will never forget the first time I started IEx from within a Phoenix project, and found that I had a live shell into the running application, while the Phoenix development server was running and reachable from the browser, all with hot code reloading... No need to create a dummy REST endpoint to try running a function.

My mind was blown.

Re:Three Ways to Debug Code in Elixir by zorbash on Saturday December 04, 2021 @03:59PM (#29444265)
Another thing worth trying, is connecting a Livebook instance (see: https://livebook.dev/) to a running application. Keep in mind Livebook allows for multiple users to work on the same notebook at once so this can come handy in pair-programming / debugging situations.
Re:Three Ways to Debug Code in Elixir by derefr on Saturday December 04, 2021 @05:10PM (#29444752)
Give a remsh connection to a production cluster, you’ll find IEx really does mean “living inside” the process—you can reach out and add a live trace hook to e.g. a Phoenix Controller function, and then immediately see traces from your live prod users hitting that trace point. Without recompiling or restarting the app—their existing in-memory session state, local in-memory caches, etc. are suddenly exposed to you, without needing to discard any of it via a redeploy/restart and then wait for new user sessions to reproduce the problem.

(You can even redefine the module in-place in memory to see how changes affect what you see. Brings a whole new meaning to “hotfix”: you can do hotfixes that don’t even exist on disk!)

Re:Three Ways to Debug Code in Elixir by dnautics on Saturday December 04, 2021 @04:47PM (#29444587)
It's like you are in bash, except you can run real functions, and your variables aren't stringly typed.
Re:Three Ways to Debug Code in Elixir by arthurcolle on Saturday December 04, 2021 @03:35PM (#29444068)
:observer.start is awesome too