New EEP draft: Pinning operator ^ in patterns
Loïc Hoguin
essen@REDACTED
Fri Dec 25 16:57:56 CET 2020
I get the feeling, occasionally you move code around and variables end
up having the same name and things break. But it's so rare that 1- you
forgot to check variable names and this happens; and 2- tests don't
catch the mistake; and 3- code review doesn't notice the problem, that I
don't think I would end up using this.
Merry Christmas!
On 24/12/2020 21:10, Richard Carlsson wrote:
> The ^ operator allows you to annotate already-bound pattern variables as
> ^X, like in Elixir. This is less error prone when code is being
> refactored and moved around so that variables previously new in a
> pattern may become bound, or vice versa, and makes it easier for the
> reader to see the intent of the code.
>
> See also https://github.com/erlang/otp/pull/2951
>
> Ho ho ho,
>
> /Richard & the good folks at WhatsApp
--
Loïc Hoguin
https://ninenines.eu
More information about the erlang-questions
mailing list