Elixir v1.10.0-rc.0 released

Pattern matching works great here without needing is_struct/2.

def sample(%__MODULE__{} = struct), do: {:ok, struct}

Actually not sure in what situations I should use the new guard since is_struct/1 could also be written as:

def sample(%_{} = struct), do: {:ok, struct}

The guard reads intent more explicitly to me but AFAIK the pattern matching works as well.

1 Like