News for hackers. Stuff that matters.
Re:Elixir and Phoenix after two years by vram22 on Monday April 05, 2021 @07:42PM (#26706136)
Don't know Elixir. Understand a bit about pattern matching from dabbling in OCaml and F#. Not clear about this:

>you have to basically mentally imagine what all cases are covered and what they mean

Why? Isn't the logic clearly specified in some way by the multiple dispatch/multi-methods? Because if not, how does the program work? So shouldn't a user be able to read the multi* code, and understand it, just like they can with if/else statements?

Re:Elixir and Phoenix after two years by dnautics on Monday April 05, 2021 @08:03PM (#26706296)
one difference is that you can really afford to be lazy with elixir. If your pattern match fails, one option is to let it throw a MatchError. Especially if the failure is rare, you just let the process die and your supervisors will restart the process into a sane state, and hopefully the next time you hit the code path it will be ok (for example: you are calling out to a 3rd party web service and they have a brief service outage, or some backhoe went over a network link and killed your packets).