Rob Lacey

Brighton, UK -

Software Engineer specialising in Ruby on Rails. I do occasional freelance work, I love working for SARD JV Ltd, they are awesome and give me my pocket money every month. By all means dangle a carrot.

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.