A safer Elixir | Esteban Ibarra | ElixirConf EU 2021

Code Sync: A safer Elixir | Esteban Ibarra | ElixirConf EU 2021

Comments welcome! View the #code-sync and #elixirconf-eu tags for more Code Sync and ElixirConf EU talks!

1 Like

I would like to add Dialyzer to the list.

And I think you should avoid pattern matching on keyword lists (it a big NO-NO in Elixir IMO), since pattern matching relies on the order of their elements. Here’s an example to show what I mean:

iex(1)> %{a: a, b: b} =  %{a: 1, b: 2}
%{a: 1, b: 2}

iex(2)> %{a: a, b: b} =  %{b: 2, a: 1}
%{a: 1, b: 2}

iex(3)> [a: a, b: b] =  [a: 1, b: 2]                            
[a: 1, b: 2]

iex(4)> [a: a, b: b] =  [b: 2, a: 1]
** (MatchError) no match of right hand side value: [b: 2, a: 1]
4 Likes