Re: New EEP draft: Pinning operator ^ in patterns
Raimo Niskanen <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jan 16, 2021 at 02:20:17PM +0100, Mikael Pettersson wrote: > On Fri, Jan 15, 2021 at 4:36 PM Raimo Niskanen > <[email protected]> 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 cleaner solution. I prefer to keep the possibility to have bound variables in patterns since I think it is shorter and more concise. : > > /Mikael -- / Raimo Niskanen, Erlang/OTP, Ericsson AB