11 ms·
I’ve played with Elixir/Phoenix a little bit and was not very happy with a few things: - Debugging is hard. You can’t throw a REPL wherever your want in your c
by hartator 6y ago
I’ve played with Elixir/Phoenix a little bit and was not very happy with a few things:
- 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.
- rorygreen 6y ago> You can’t throw a REPL wherever your want in your code 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.
- dnautics 6y agodialyzer is terrible, but vscode/elixir_ls + dialyzer is quite frankly amazing.
- dnautics 6y ago1. IEx.Pry, if you are used to ruby's pry. Pipe states are extremely easy to inspect: 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/00875891748bed3ee68e5f1b75c1ffe1 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.
- rorygreen 6y agoOh. Dropping IO.inspect into the pipeline is embarrassingly obvious! I can't believe I didn't think to do that. I always used IO.inspect as a pretty printer during development but I guess I didn't think it would return/pass through its input. Thanks for pointing that out. I clearly hadn't bothered to read the 'Getting Started - Debugging' page on the Elixir website at any point.
- dnautics 6y agoOh man I'm so sorry. The difference between using io.inspect like this and not is a the difference between "huge pain, worst ever" and "best concurrent debugging feature ever". IO in erlang is atomic, so in concurrent systems IO output will never be interrupted by IO output from another thread, which is not generally true in other systems (c, c++, rust, go). It makes a HUGE difference.
- 1_player 6y agoHow is serving static files super hacky? We're serving assets and custom uploads from Phoenix and it took me about 10 seconds to set it up (just change the Plug.Static configuration)