Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I also find a lot of joy in its pattern matching and its pipe operator. It’s refreshing writing heavily functional code that still approaches the beauty of ruby, and I find that it drives me to think clearly about my code and write fewer bugs as a result.

This.

I use Elixir everyday. While it feels 'refreshing' to use pattern matching, sometimes it gets over-used, as a simple swtich-case statement is easier to read.

Same with pipe operator. I found newbie programmers tend to pipe for the pipe's sake, and write functions just to form the 'shape' of pipe, but the data shape changes are not easy to see and inspect.



Doesn’t pattern matching lead to either more verbose code or a duplicate code? Most of the time?


It could, when its used "wrong", though thats usually a result of trying to fit pattern matching where there are other more idiomatically way to express a code. I wouldn't say "most of the the time", its more of a common beginner's mistake.

Pattern matching allows you to express the code in a more declarative way, and usually would result in a more succinct code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: