New EEP draft: Pinning operator ^ in patterns

Olivier Boudeville olivier.boudeville@REDACTED
Fri Jan 15 19:35:06 CET 2021


Le 1/15/21 à 4:35 PM, Raimo Niskanen a écrit :
> 1) Would the language be a better language with a mandatory pinning operator?

Hi,

Thanks Raimo for this interesting EEP. As for me, I could do without 
pinning. Would such a feature impact the AST?

On a related "hazardous matching" topic, there is an Erlang "language 
feature" that could (IMHO) be removed for the best, hopefully with no 
issue in terms of backward-compatibility: the infamous matching of muted 
variables. I am a big fan of commenting thanks to a muted variable the 
intent related to an argument, like in:

    send_safe(_DefaultTimeout=1000, _AttemptCount=5, ...),

...but of course such bindings will collide with any other, potentially 
unrelated _DefaultTimeout or _AttemptCount bindings in the same scope, 
resulting in "surprise-matches" that could be spared to the unwary 
developer.

Couldn't we stop matching these muted variables, knowing that their 
management is already special-cased in some contexts? (for example they 
do not trigger unused warnings; "_" is never bound either). No sane 
existing code should rely on this kind of match anyway, isn't it? Or is 
there a use-case I overlooked? If the semantics of muting is "don't care 
about the value", isn't it more surprising that they match rather than 
they do not?

Best regards,

Olivier.

-- 

Olivier Boudeville



More information about the erlang-questions mailing list