You are on page 1of 27

Dive Into Elixir

Alexei Sholik
December 10, 2013 @ Build Stuff

About me
Hi, I'm Alex
I do mainly C++ / Objective-C / game dev for a
living
I've been involved in Elixir development since
2012 (occasionally)

About this talk


1. What is Elixir?
2. Macros
3. The future

What is Elixir?
Definition:
"Elixir is a functional, metaprogramming aware language built
on top of the Erlang VM."

What is Elixir?
Opinions:
"Erlang with Ruby syntax?"
"Syntactic sugar for Erlang?"
"Erlang already has macros. Why
another language?"

What Elixir is
Definition (redux):
"Elixir is a functional, metaprogramming aware language built
on top of the Erlang VM."

What Elixir is
Nice, readable and writeable syntax

What Elixir is
A friendly REPL

What Elixir is
Small and powerful stdlib

What Elixir is
Elixir is extensible (1)

github.com/dynamo/dynamo

What Elixir is
Elixir is extensible (2)

github.com/meh/jazz

What Elixir is
Transparent access to all Erlang VM facilities

And finally
Elixir is fun

Macros
Did you know?

Macros
Meta-programming in Erlang:
parse transforms
myfun({command, X}, Args) ->
io:format("Command: ~p, Args: ~p", [X, Args]).
{function,4,myfun,2,
[{clause,4,
[{tuple,4,[{atom,4,command},{var,4,'X'}]},{var,4,'Args'}],
[],
[{call,5,
{remote,5,{atom,5,io},{atom,5,format}},
[{string,5,"Command: ~p, Args: ~p"},
{cons,5,{var,5,'X'},
{cons,5,{var,5,'Args'},{nil,5}}}]}]}]}

See Yurii Rashkovskyi's talk for examples

Macros
Meta-programming in Erlang:
use at your own risk

Macros
Meta-programming in Elixir
is better studied in its natural habitat

Macros
In summary: quite a useful tool

Things I left out


details about protocols
records
mix project manager and build tool
error handling (stick to Erlang style)
typespecs and Dyalizer
documentation on quote

Useful links
elixir-lang.org
reference docs
the wiki
elixirsips.com (screencasts)
elixir-fountain.com (newsletter)

The future
Elixir is gradually approaching 1.0
The community and the ecosystem are growing at
an increasing rate
Introductory learning material is plenty (tutorials,
blogs, two books in early access)

The future
Advanced documentation is still lacking
Use in production is modest
I personally hope to see ElixirWerkz and BEAM
community develop into something real

The future
The vision:
more convenient
more productive
more fun experience
when building applications for the Erlang VM

Erlang VM
At run time, it's Erlang all the way down

Erlang VM
Elixir <X> are Erlang <X>
:erlang.binary_to_list("abc") # Erlang list
|> String.from_char_list!
# UTF-8 binary
|> :erlang.is_binary
# true

Erlang VM
Therefore, Elixir lets you build
concurrent
fault-tolerant
scalable
highly available
applications

Thank you
Questions?
@true_droid
github.com/alco

You might also like