by hartator · 6y ago · 0 comments
- Debugging is hard. You can’t throw a REPL wherever your want in your code and pipe states are hard to inspect.
- Serving static files in Phoenix is oddly super hacky.
- Deploy is hard. Mostly by the lack of support out there in term of documentation and services.
abc
|> foo()
|> bar()
to abc |> IO.inspect(label: "a")
|> foo() |> IO.inspect(label: "b")
|> bar() |> IO.inspect(label: "c")
If you use vscode, this user snippet will inject this (with line numbers as labels) when you type "ins <tab>", which can be used to great effect with multiline cursors. Since line numbers are usually the same length in any given block of code, it's equally easy to ninja those IO.inspects out with the delete key. https://gist.github.com/ityonemo/00875891748bed3ee68e5f1b75c...2- agreed
3- Mix releases have solved 80% of this problem, for me. Since it's trivially extensible, I do a series of compile-time checks, include verifying that the current branch is on master and correctly git-tagged; and then uploading to Amazon S3. I haven't done this yet, but it's going to eventually trigger an automated blue-green deploy.
I clearly hadn't bothered to read the 'Getting Started - Debugging' page on the Elixir website at any point.
In my experience, I found I could throw a `require IEx; IEx.pry` pretty much anywhere in the code to get a REPL. This seemed like a unique superpower of Elixir to me. Where have you found that this isn't possible?
I agree with the pipe states point.
My main complaint with Elixir is that I'd discover really stupid mistakes with run time errors. The sort of things a bunch of other languages I've used would preclude at compile time. I never dug into more advanced debugging or Dialyzer though.