Right now if you want to do an "OR" match in a function head, you probably need to use guards and `in` (or duplicate bodies):
def foo(value) when value in [ :this, :that ], do: a_thing def foo(value), do: another_thing # or def foo(:this), do: a_thing def foo(:that), do: a_thing def foo(value), do: another_thing It occurs to me that this is quite a lot of typing for something pretty simple, and so I was wondering what people thought about the following: def foo(:this | :that), do: a_thing def foo(anything_else), do: another_thing It could unpack to create an extra foo/1 match. The benefit is less typing, less noise, and it flows better when working (it also matches the syntax of a type spec). Definitions would go from left to right, meaning that the pattern on the left would be declared first so that it's natural when following how things are matching. I took a look around code on GitHub, etc, and it seems the community in general would make good use of this (it'd be even better if we could make it work in a `case` by itself). Not sure if this has been discussed or shot down before, but figured I might as well be the one to bring it up if it hasn't :) Thanks all, appreciate thoughts! IW -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/b108ba5c-5dd5-4d14-9264-a2169c80d1e4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.