Re: New EEP draft: Pinning operator ^ in patterns

Raimo Niskanen <[email protected]>
Newsgroups gmane.comp.lang.erlang.general,gmane.comp.lang.erlang.eeps
Message-ID <[email protected]>
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 ;)
> https://twitter.com/joeerl/status/969579433769295873

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:
  https://stackoverflow.com/questions/4442314/differences-between-pattern-matching-and-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
> http://snowsyn.net
> [email protected]

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
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.