Hacker News new | ask | show | jobs
by noneeeed 2102 days ago
What do you think it is about Elixir that leads to beautiful/maintainable code? I keep thinking about giving it a try.
2 comments

My mind instantly darts to the combination of piping + pattern matching.

Edge cases can live as two line adjustments in ways I don't know how to do in any other language.

Worth noting that the concepts of piping and pattern matching don't just exist in the language itself, but also in an architectural level. Plugs, for example, allow you to "pipe" entire web requests in a very elegant and logical fashion.
Couldn't have answered the question better/more succinctly myself.

When I'm working on the JavaScript (front end) side of an Elixir project, I repeatedly get into these positions where I'm thinking, "Man, I could express this so succinctly and elegantly in Elixir. There's no way in JavaScript that doesn't feel clunky in contrast."

That makes sense. For a period of my career I did some Prolog and always liked the way pattern matching allowed you to write extremely descriptive code.

Funnily enough, I think pattern matching is one of the most exciting things to happen in Ruby for a long time. While it isn't on a par with functional pattern matching it's still going to be incredibly useful.

Pervasive use of pattern matching, including function definitions. It makes if-less programs a reality. IMHO enumeration is much easier to read.