|
|
|
|
|
by elicksaur
863 days ago
|
|
What are you saying isn’t the same? This is a very hostile, dismissive response when I was simply pointing out Python had a similar concept in the hopes it might help the person understand something they said confused them. As far as I can tell all three languages, Python, Elixir, Ruby, have pattern matching and the matching can set variables. Python’s has a “match” keyword. I’m not as familiar with Ruby, but I know it uses “case”. I like Elixir’s the best because it’s not just what I would call a fancy switch statement. You can use it on single lines and in function definitions. Someone else might like a different form of pattern matching better. It’s just an opinion. |
|
Elixirs pattern matching is the one thing I wish every language had from day one. Besides maybe an Optional/Maybe concept for error handling / data enclosures.
It makes for some very readable code and encourages passing return values that are easily consumed in a simple/functional way. Not capturing random error objects or unpredictable data structures.
Although I'm biased towards functional style, even though I code JS/Ruby for a living.