Please log in to watch this conference skillscast.
This talk will introduce developers to Elixir and the underlying Erlang VM and show how they provide a new vocabulary which shapes how developers design and build concurrent, distributed and fault-tolerant applications. The talk will also focus on the design goals behind Elixir, use cases, and include some live demos.
Question: Were you already thinking of BEAM as a target VM for this?
Answer: Elixir only exists because of the BEAM. I wanted specifically to use the Erlang VM!
More interesting tech notes about Whatsapp: at some point they crossed 1 billion active users daily and there were more messages going through Whatsapp in a given day than the whole global SMS system. Here is one reference: https://fortune.com/2017/07/28/whatsapp-one-billion-daily-users/
Question: Is it true that Elixir was originally supposed to be Ruby targeting BEAM? What is the true Elixir backstory?
Answer: Not really, it was never intended to be a Ruby port. Even at the beginning, when Elixir was object-oriented, the object model was different from Ruby's and it included features Ruby did not have, such as pattern matching.
Question: Oh, I didn’t know Elixir was OO at the beginning!
Answer: it was at the very beginning, before it was ever
released. like in the very early prototype stages. but the code is all on the
github repo. here is some link of how the List
module object looked
like at the time: https://github.com/elixir-lang/elixir/blob/84e60f6bbf7fb419f43684b3cdb6b1a3536e78d5/lib/list.ex
but this is like... 1 month into the prototype. the elixir that is the elixir
from today, was released ~15 months later
Question: Was there a point when you were writing code as AST and then building the Elixir language from AST, or did you do Elixir first then exposed the AST for macro programming? Or to rephrase, where did the awesome macro capability come in the history of the language?
Answer: It came very early on. I spent about 3 months on the original prototype, which was the OO-based one, and i considered it a failure. so i went out to research and investigate how to solve the problems i was facing (meta-programming, extensibility, etc). In this process, i dug more into Lisp, but we already had 2 or 3 Lisps at the time in the Erlang VM, so I thought I would try out having Lisp-like macros but without having the s-Lisp language.
Then I was building the AST and the macros side by side. here is a sketch i wrote early on exploring those ideas: https://github.com/josevalim/lego-lang
I also later learned that the original Lisp paper by John McCarthy had the same idea. there was a s-lisp, which was the AST, and the m-lisp, which was a higher level syntax that became s-lisp! But s-lisp was the one that really gained traction. (edited)
Btw, here is the Livebook project that I am demo-ing: https://github.com/elixir-nx/livebook/ - there is also a docker image now, so if you never played with Elixir before, you can install Livebook and have something to experiment with.
Question: Speaking of Nx, when you announced it a few weeks ago, I thought it was an April Fools joke at first :laughing:. Are you still actively working on that, or are you cooking up the next big thing?
Answer: haha, I believe Nx, Livebook, and numerical computing is likely to be my focus over the next years!
Question: do you have plans to combine Nx with Flow as an answer to Flink/Spark? I know the idea behind Flow is to solve “small data” problems, but with Nx you’ve shown that Elixir has the potential to do serious numerical computing, so why stop at “small data”?
Answer: perhaps we can do that! or perhaps it has to be something different that simply coordinates Nx work on the data. I haven't thought that far yet :)
Question: Could have Elixir being implemented in the JVM? Would have been able to get a similar performance?
Answer: Elixir really relies on the power of the Erlang VM, so it can only happen if someone ports all of the Erlang VM backbone to JVM, which is a huge amount of work. There was Erjang but I don't think it is still maintained. (the last commit was 5 years ago https://github.com/trifork/erjang)
Question: I was so excited when I realised the macros were quoted AST - for a while there it was my hammer and everything was a nail (I mostly recovered from that, but it’s still awesome)
Answer: Haha, yes! That's why the first rule of the macro club is don't use macros
Some more links:
- ExUnit test framework: https://hexdocs.pm/ex_unit/
- Ecto for query and data toolkit: https://hexdocs.pm/ecto/
- Nx for numerical computing and hardware acceleration: https://github.com/elixir-nx/nx/tree/main/nx#readme
And more links from the talk:
- Phoenix (apis and realtime interactive web apps): https://www.phoenixframework.org/
- Nerves (embedded): https://www.nerves-project.org/
- Membrane (audio/video streaming): https://www.membraneframework.org/
And of course, the Elixir website too: elixir-lang.org
YOU MAY ALSO LIKE:
Idioms for building fault-tolerant applications with Elixir
Chief Adoption Officer