New EEP draft: Pinning operator ^ in patterns
Fri Jan 22 16:42:18 CET 2021
> On 22 Jan 2021, at 16:05, Raimo Niskanen <raimo+erlang-questions@REDACTED> wrote:
> Then came things like "pretend it is broken until your solution looks
> marketable", "use Elixir instead", "write smaller functions and the problem
> goes away", "this would damage the language and the community".
I think it's legitimate to think about unintended consequences of this kind of change.
If Erlang had this from the start how would the body of Erlang code look today? Would it be more or less beautiful on balance? How much would people use matching on bound variables.
I just looked through my Elixir codebase - There are zero occurrences of matching on bound variables in normal code. There are a *lot* of carets, but all are used in the ecto DSL where it is required to pass in a parameter to a query.
But I use this feature in my Erlang code all the time.
Why the difference? I honestly don't know. I guess it doesn't feel idiomatic in a language where matching a bound variable requires a caret and there are other ways to express the same thing.
Perhaps I have a subconscious caret allergy. Or maybe the caret simply introduces enough friction for me that the alternative feels cleaner. I don't know how it will seem in Erlang.
I do get that we are not a new language, and tools for large codebases and many programmers are good.
Some of Richard's examples are also rather nice - especially the network message receive patterns.
More information about the erlang-questions