Lessons: Intermediate
Building on upon our foundation these lessons introduce topics like concurrency, error handling, and interoperability.
Creating custom Mix tasks for your Elixir projects.
One of the added benefits to building on top of the Erlang VM (BEAM) is the plethora of existing libraries available to us. Interoperability allows us to leverage those libraries and the Erlang standard lib from our Elixir code. In this lesson we’ll look at how to access functionality in the standard lib along with third-party Erlang packages.
Although more common to return the {:error, reason}
tuple, Elixir supports exceptions and in this lesson we’ll look at how to handle errors and the different mechanisms available to us.
In general the convention in Elixir is to create a function (example/1
) which returns {:ok, result}
and {:error, reason}
and a separate function (example!/1
) that returns the unwrapped result
or raises an error.
This lesson will focus on interacting with the latter
To build executables in Elixir we will be using escript. Escript produces an executable that can be run on any system with Erlang installed.
One of the selling points of Elixir is its support for concurrency. Thanks to the Erlang VM (BEAM), concurrency in Elixir is easier than expected. The concurrency model relies on Actors, a contained process that communicates with other processes through message passing.
In this lesson we’ll look at the concurrency modules that ship with Elixir.
In the following chapter we cover the OTP behaviors that implement them.