AstonJ

AstonJ

Elixir In Action Book Club!

Welcome to our Elixir In Action Book Club! :048:

This book was recently released in its third edition so we thought it was about time we had a book club on it! It is being led by @code-shoily and @juhalehtonen and the author of the book, @sasajuric, will also be dropping in from time to time - so if you have any questions it could be a great way to interact with the author!

Here’s the full list of participants:

There’s no strict schedule but we encourage everyone to post at least once per chapter, and please remember that while criticism is fine, please be kind - book authors are our friends and members of the community too :blush:

Everyone else is also welcome to join the book club or to comment on anything you find interesting. For anyone who wants to join or purchase the book we’ve also got a limited-time 45% off coupon - simply use elixclub24 at checkout over at manning.com! :023:

Most Liked

bjorng

bjorng

Erlang Core Team

Having the read the first chapter of the book, I don’t have much to say. I think it is a really good introduction to the BEAM, Erlang, and Elixir, with just the right amount of details.

Thanks for that introduction! Now I must try to live up to it. :003:

I will take this opportunity to introduce myself and my experience of programming in Elixir.

I wrote my first Elixir programs in December of 2018. José posted a few screencasts showing the puzzles in Advent of Code. I immediately decided that I wanted to solve the puzzles while learning Elixir. It turned out that the puzzles themselves was the hardest part. Learning Elixir (enough to solve the puzzles) was easy. I read the crash course for Erlang developers to get going and then I learned more by looking at the other solutions in the forum, and especially at @sasajuric’s elegant solutions using Enum, Stream, and the pipe operator.

Here is a little about myself and my work in the OTP team.

I am the Björn in “Bogdan/Björn’s Erlang Abstract Machine (BEAM)” mentioned in the book.

I joined the OTP team at the end of 1996, and the first Erlang/OTP release in which some of my code was included was OTP R1D. A few years later, when the inventor of BEAM, Bogumil “Bogdan” Hausman, left Ericsson, I became the main developer responsible for BEAM.

To put that in context, I’ll need to explain how the meaning of the word “BEAM” has changed. Nowadays, the word “BEAM” (at least in common speech) seems to have evolved to mean the entire runtime system for Erlang. That it is also the sense used in the book.

At that time (OTP R1 through OTP R6 R5), there existed two Erlang implementations side by side: Joe Armstrong’s original JAM (Joe’s Abstract Machine) and BEAM. They shared the source of the runtime system (scheduler, BIFs, garbage collector, ETS, drivers, and so on).

“BEAM” at that time only referred to the part of the runtime system that executed the BEAM instructions. That is the part that I spent many years on improving and maturing so that it could replace JAM completely. My own invention in that area is the loader of BEAM code.

My blog post A Brief History of the BEAM Compiler goes beyond its title, giving more details on the early Erlang implementations in general, and BEAM and my involvement in its development in particular.

Returning to the book, the only thing that I think could have been added and is perhaps worth adding in the fourth edition, is a mention of the JIT (Just-In-Time compiler) in the Speed section. As written in the book, we in the OTP team do try to keep the performance as predictable as possible, but we also try to improve the raw performance with the goal to make it less frequently necessary to use libraries or programs implemented in C/C++/Rust. But my opinion in that matter is hardly unbiased. :slight_smile:

Perhaps another language feature is worth emphasising: the bit syntax/binary syntax. It makes parsing of binary protocols much easier than in most other languages. For example, the PER encoding rules for ASN.1 is a nightmare to implement in other languages, but quite easy to implement in Erlang/Elixir using the bit syntax.

sasajuric

sasajuric

Author of Elixir In Action

Hi everyone :wave:

It’s great seeing so many people here! I’m looking forward to the fun discussions. I’ll try to keep up as much as possible, but obviously I can’t address every comment & question. If you feel I’ve glossed over or skipped some important point or question, hit me a DM.

This was listed as an example of what can be done with macros, but in general, as the author of ExActor, I don’t recommend using it :slight_smile: I shall try to find a better example for the next edition.

People are using Rust together with Erlang/Elixir. I think Rustler is a popular choice (Rustler — Rustler v0.38.0). I didn’t think about explicitly mentioning it, but I’ll reconsider this for the next edition.

Ideally those would be reported at the official book page on manning, so they can be marked as correct, and fixed with the next update. But if it’s too much trouble, you can report it here, and I’ll see about transferring them over there.

Suddenly I’m starting to feel slightly nervous :sweat_smile:

I remember that! It was so much fun comparing solutions!

Great point, this should be mentioned. The 1st edition was written way back when there was no JIT, and I somehow missed this opportunity during the update. I’ll see about fixing it in the 4th.

Fun fact: the first drafts used the term EVM (Erlang Virtual Machine). But after discussing it with a few folks, I’ve changed it, because it wasn’t really used in the community, while BEAM seemed to be more popular than ERTS. I wonder if at this point the ship has sailed (for which I’m probably partially guilty myself)?

This is the correct interpretation. Also, the table tells the true story, not some hypothetical. Having worked on both systems from day 1, I was confident that the 1st one could be vastly simplified with Erlang. But yeah, I’m not suggesting that the Erlang solutions can always replace the mentioned products.

AstonJ

AstonJ

*Reads the rest of your post..

You already have Björn :blush:

Would also like to take this opportunity to thank you and everyone else who has worked or works on Erlang and the BEAM - Elixir and this community only managed to get to where it has because of you and all your hard work spanning decades :heart: :purple_heart:

Where Next?

Popular in Discussions Top

blackode
Elixir Upgrading is so Simple in Ubuntu and It worked for me Ubuntu 16.04 git clone https://github.com/elixir-lang/elixir.git cd elixir...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
Ankhers
Just a little information upfront. Generally speaking, if I feel like I need to either break a pipe chain or use an anonymous function in...
New
New
rms.mrcs
A couple of days ago I was discussing with a friend about different approaches to write microservices. He said that if he was going to w...
New
100phlecs
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement