191 points · by qubitcoder · 9y ago · 38 comments
Elixir has it all (well, almost). It's fast, it's compiled AND interpreted, it has a REPL, it has strong concurrency, reliability and scability backed into the VM. It has a simple and beautiful syntax. It has great tooling and is very well documented. The only thing you might miss is static typing.
I've been looking for my next programming language of choice after Ruby for almost 2 years now. Clojure was the closest I got to replacing Ruby, but now with Elixir it's just such an obvious choice.
If you haven't tried Elixir yet, PLEASE go and do it right now, you won't ever regret it.
https://www.infoq.com/interviews/johnson-armstrong-oop
Then, my thesis supervisor said "But you're wrong, Erlang is extremely object oriented". He said object oriented languages aren't object oriented. I might think, though I'm not quite sure if I believe this or not, but Erlang might be the only object oriented language because the 3 tenets of object oriented programming are that it's based on message passing, that you have isolation between objects and have polymorphism.
Though I must said I am pretty happy with CLOS (Common Lisp Object System), in particular its generic functions.
Dude, Elixir compiles to BEAM, it's slow as hell. Have you ever compared its processing speed with virtually anything else? It's not processing speed that Erlang is sold about.
A bit of an exaggeration. It's not as fast at math as Java. It's quite faster than Ruby (while keeping coder-friendly features such as auto-rollup to bignums). If you use pattern-matching correctly, it is EXTREMELY fast at I/O or binary parsing. That puts it in a unique space of "people who don't want to sit on the JVM yet want a fully-functional language that has an accessible syntax AND macros AND massive concurrency"... Web developers, basically.
Let's see your favorite "faster" language do THIS: https://discord.engineering/how-discord-handles-push-request...
My experience with Clojure ended when I got a blown-up gross Java stack trace because I went out of bounds on the underlying Java int representation. Fuck that, I consider that "janitorial duties" and not something I should be responsible for as a programmer. YMMV. No offense to you C guys. ;)
http://adrian-philipp.com/post/why-elixir-has-great-potentia... Check out the chart: https://cloud.githubusercontent.com/assets/133832/21369162/f...
You know how "simpler is better" from a maintenance standpoint? Elixir has that in spades.
> A bit of an exaggeration.
Actually, no. Last time I compared BEAM (Erlang) and something else, Erlang code that only parsed text data from a file (CSV) was several times slower than Perl script that parsed that, built a structure, serialized it, and wrote back to a disk file (BerkeleyDB).
> It's quite faster than Ruby (while keeping coder-friendly features such as auto-rollup to bignums).
I doubt it, unless Ruby (MRI is what I think of) is an extremely poorly written interpreter.
> If you use pattern-matching correctly, it is EXTREMELY fast at I/O or binary parsing.
It's not. It's slow (I've seen it when comparing with other runtimes). It was never intended to be fast. It was always intended to be convenient and highly concurrent.
Fast at what?
From what I read, Elixir is very fast at I/O based tasks, especially when there is lots of blocking involved. For example orchestration layers that push data between various API's and/or handle many concurrent connections.
Languages that compile to the JVM like Scala or Clojure (or Java of course) will probably be faster for computation.
I see Elixir as being suitable for the same category of applications as nodejs.
While being a hell of a lot saner.
https://www.quora.com/How-is-Elixir-Phoenix-better-than-Node...
Now make two steps back and read this again. What you say is that Elixir is "very fast" when it comes to tasks when Elixir pretty much doesn't do anything, so it being fast or slow doesn't matter. Hardly a definition of "fast".
But it is actually true for BEAM machine. It was never intended to be fast, it was intended for running many tasks at the same time (so that none of them starves others for any reason).
On par with the claim that "Elixir is fast".
> Processing speed for what workload on what hardware?
Sequential processing, what did you think? BEAM excels at running many sequential processes at the same time, it would be very hard to match that. (And that's why for text processing I use Perl or sometimes Python, but for services that pass data back and forth through network I use Erlang.)
Clojure runs on the JVM and interops with Java, which can be both an advantage or drawback, depending on who you ask. Personally, I don't enjoy working with the JVM too much, but people who are already using a Java / JVM stack can easily switch to Clojure while still being able to use all their libraries. Elixir runs on top of the Erlang VM which at least feels a lot more lightweight than the JVM, and has a strong focus on distributed, concurrent and fault-tolerant systems. Also, you can interop with Erlang, so you have access to many mature libraries, same as Clojure has on the JVM.
Both Clojure and Elixir focus on concurrency and bring first-class support out-of-the-box.
Clojure is a Lisp, which in terms of syntax is usually controversial. I personally love it, but a lot of people are overwhelmed by too many parentheses, and I kind of understand them. Elixir has a pretty polished, easy on the eye syntax. Of course, coming from Ruby, I might be a bit biased, would love to hear what people with other backgrounds think about it though.
One negative point about Clojure is that it's difficult to have a really smooth and quick development environment, and debugging Clojure can be a tough task, as it basically dumps tons and tons of Java stacktraces that are very difficult to process. Here, Elixir clearly wins, as it has one of the best and most accurate stacktraces and error messages I've seen in a programming language.
In the end, I think both are just terrific programming languages and have their own reasons to be. I'd actually love to work someday at a company where people would use Clojure, Elixir and many other functional programming languages, depending on the task at hand and the requirements :)
http://elixir-lang.org/getting-started/binaries-strings-and-...
[0] https://www.bignerdranch.com/blog/elixir-and-io-lists-part-2...
Erlang's normal "string" type is indeed a list of integers representing codepoints. Erlang also supports "bitstrings" or "binary strings", which are basically what most other languages would just call "strings", as a logical extension of its existing binary data syntax.
Elixir instead uses Erlang "bitstrings" as its default "string" type. Erlang integer-list-based "strings" are represented in Elixir by using single-quotes instead of double-quotes around such a string (or by just manipulating a list directly; Elixir will transparently convert a list of integers into an Erlang-style charlist if the integers are valid codepoints).