New EEP draft: Pinning operator ^ in patterns

Raimo Niskanen raimo+erlang-questions@REDACTED
Fri Jan 15 16:14:23 CET 2021

On Fri, Jan 15, 2021 at 03:52:27PM +0100, Nicolas Martyanoff 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 ;)

Joe wrote: "one way unification (from Prolog)"
I read this as either "[one way unification] (from prolog)" or
"one way [unification (from prolog)]" and think it is the latter.

StackOverflow has a thread about Pattern Matching vs. Unification:

Would you agree that Erlang's "unification" is asymmetrical since the first
occurence of a variable always succeeds for a new variable (binding), and
that all following occurences must have the same value (matching) or else
there is a badmatch runtime exception?

> -- 
> Nicolas Martyanoff
> khaelin@REDACTED


/ Raimo Niskanen, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list