New EEP draft: Pinning operator ^ in patterns
Mon Jan 18 11:07:51 CET 2021
On Sat, Jan 16, 2021 at 02:20:17PM +0100, Mikael Pettersson wrote:
> On Fri, Jan 15, 2021 at 4:36 PM Raimo Niskanen
> <raimo+erlang-questions@REDACTED> wrote:
> > And I want to get clarity about exactly why so many developers are worried
> > about this particular proposed change, and therefore try to look thoroughly
> > at the arguments.
> > It is as you say a fundamental detail in the language.
> > 1) Would the language be a better language with a mandatory pinning operator?
> > 2) If so is there a migration path worth the trouble?
> > So far I think the discussion has been centered around 2),
> > before talking about 1).
> I acknowledge the issue the pinning operator is trying to solve, but I
> disagree with the solution, especially the syntactic noise and
> special-case semantics of the operator.
> I believe that a better solution is to gradually abolish the notion
> that variables in patterns may refer to the surrounding scope. This
> means adding "when PatVar = OtherVar" guards in the few affected
> places, but those guards are already part of the language, and already
> required in some contexts. That is, nothing needs to be _added_ to the
> language, instead the language is simplified by having fewer special
> cases in its semantics.
I think the latter would add more text noise, although being a theoretically
I prefer to keep the possibility to have bound variables in patterns since I
think it is shorter and more concise.
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions