Rob Lacey

Brighton, UK -

Software Engineer working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working at making code out of bricks.

Elixir Error Reporting is pretty good huh?

As much as Elixir feels quite alien at times. The error reporting is really very thorough.

iex(4)> c =,1)
{:ok, %IslandsEngine.Coordinate{col: 1, row: 1}}
iex(5)>, c)               
** (FunctionClauseError) no function clause matching in    
    The following arguments were given to
        # 1
        # 2
        {:ok, %IslandsEngine.Coordinate{col: 1, row: 1}}
    Attempted function clauses (showing 1 out of 1):
        def new(type, %IslandsEngine.Coordinate{} = upper_left)
    (islands_engine 0.1.0) lib/islands_engine/island.ex:7:
iex(5)> {:ok, c } =,1)
{:ok, %IslandsEngine.Coordinate{col: 1, row: 1}}
iex(6)> c
%IslandsEngine.Coordinate{col: 1, row: 1}
iex(7)>, c)                       
   coordinates: #MapSet<[
     %IslandsEngine.Coordinate{col: 1, row: 1},
     %IslandsEngine.Coordinate{col: 1, row: 2},
     %IslandsEngine.Coordinate{col: 2, row: 1},
     %IslandsEngine.Coordinate{col: 2, row: 2}
   hit_coordinates: #MapSet<[]>

I initially thought that an aliased %Coordinate{} could not be pattern matched against an %IslandEngine.Coordinate{}. Wrong. it can’t be pattern matched against a tuple. Wally.