I'm still new to Elixir but we have some type of half baked typing system already available right?
For example if you wanted some function to work with both a string and list you could use pattern matching and "when".
Something like:
def myfunc(input) when is_binary(input) do:
# ...
def myfunc(input) when is_list(input) do:
# ...
Of course it's not the same and you lose a bunch of useful static analysis tools, but from a usability POV, you could skim function heads and quickly see what types are supported. To me, this is a big win compared to having a massive elseif or case statement buried into a single function where at call time you have no context on what's expected.
For example if you wanted some function to work with both a string and list you could use pattern matching and "when".
Something like:
def myfunc(input) when is_binary(input) do: # ...
def myfunc(input) when is_list(input) do: # ...
Of course it's not the same and you lose a bunch of useful static analysis tools, but from a usability POV, you could skim function heads and quickly see what types are supported. To me, this is a big win compared to having a massive elseif or case statement buried into a single function where at call time you have no context on what's expected.