New EEP draft: Pinning operator ^ in patterns

Mikael Pettersson mikpelinux@REDACTED
Fri Jan 15 16:02:34 CET 2021

On Fri, Jan 15, 2021 at 3:52 PM Nicolas Martyanoff <khaelin@REDACTED> wrote:
> On 2021-01-15 15:40, Raimo Niskanen wrote:
> > Correct me if I am wrong, but Erlang does not have unification.  Instead it
> > has got matching vs. binding, which are two different operations, as opposed
> > to unification where both sides of the unification are equivalent.
> There are multiple types of unification; I won't try to define it precisely
> since I have not work with the formal aspect of the concept for a lot of time,
> but it seems to me Erlang does implement one of the types.
> And I'm not the only one to believe so ;)

I see that's a tweet from Joe, but Erlang does not have unification.

All Erlang terms are ground, making unification pointless. The only
thing Erlang does that even remotely resembles unification is the rule
(mistake IMO) that a variable in a pattern performs a structural
equality check if that variable already is bound, otherwise binds it
if it isn't already bound. That's a compile-time decision.

The pinning operator proposal is an attempt to reduce the ambiguity of
variables in patterns.

More information about the erlang-questions mailing list