Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@mar77i patterns can only be done on terms not other patterns so they can't be recursive but you can make highly nested patterns to match against.
My impression of pattern matching is that it's a tradeoff. I can make super elegant patterns that make sure bad data doesn't enter a code pathway but now like a dozen functions have to be named "handle_json" each with slightly different matching gunk instead of a set of functions each with clear, self-documenting names saying exactly what they're handling in the json.
This might be a function of my inexperience with the language and not a real problem, I don't know yet.
I frequently am also running into situations where I write some code; when code that interfaces with external systems have an error, it shuts down the whole application because this is the Elixir/Erlang way of doing things; so I read about how to handle that and find a couple patterns you can implement; I implement the pattern and then run into some problem the trivial example doesn't address and it seems like I'm back to trying to solve the same or similar problem. This is almost certainly due to my inexperience but the language just isn't intuitive at all and its design purity makes doing some simple things in other languages laborious.
I'm complaining a lot but I'm not giving up and this is how I learn: I do my due diligence and try as hard as I can; then I complain loudly and then an expert shows up and tells me I'm an idiot and here's exactly what I'm doing wrong, and then I learn something non-trivial far faster.