Re: New EEP draft: Pinning operator ^ in patterns

Mikael Pettersson <[email protected]>
Newsgroups gmane.comp.lang.erlang.general,gmane.comp.lang.erlang.eeps
Message-ID <CAM43=SPXXoScxsMb73SdSJxR9e84cheaAcD1WN_wnsvRVW06kQ@mail.gmail.com>
On Fri, Jan 15, 2021 at 3:52 PM Nicolas Martyanoff <[email protected]> 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 ;)
> https://twitter.com/joeerl/status/969579433769295873

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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.