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:15:44PM +0100, Nicolas Martyanoff wrote:
> On 2021-01-15 13:34, Richard Carlsson wrote:
> > Imagine a world where Erlang had not allowed already-bound variables in
> > patterns (forcing you to use the idiom "X1 when X1 =:= X -> ...", as in
> > e.g. Haskell), and that someone now came with the suggestion that to make
> > things simpler, we could just implicitly match on the value of X if X is
> > already bound. The old me from my university days would probably have said
> > "that's really elegant, let's do it". But the
> > maintainability-and-readability me, with experience of very large code
> > bases, large numbers of developers, and many relative newcomers to the
> > language, would say "aw hell no". This is a cute feature, but it carries a
> > large cognitive cost and is not worth having compared to how relatively
> > little it is used. Being explicit about intention is much more important.
> 
> Unification is not a "cute feature" and it is not just about "implicitly
> matching" values, it is a fundamental part of Prolog, and thus of Erlang.
> Developers who are not used to the concept may be wary about this part of the
> language, but learning is a process everyone is welcome to.

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.


> 
> One of the reasons I ended up using Erlang was to escape the insanity of other
> languages, which became more and more complex because saying "no" is so much
> harder than caving in to requests. The Erlang/OTP team at Ericsson has done a
> good job keeping the language sane for years, and I hope they continue to do
> so.
> 
> -- 
> 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.