Re: New EEP draft: Pinning operator ^ in patterns

"Richard O'Keefe" <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CABcYAd+Q4-DbSmehmCV_EVJJkQFfuv1B-ZmjbqWxKYyMWTVW4Q@mail.gmail.com>
Am I the only one who finds the word "pinning"
confusing?  I know what "pinning a bone" means.
I know what "pinning an insect to a board"
means.  I know what "pinning an enemy/opponent"
means in war, wrestling, or chess. I am not an
Elixir programmer (the syntax has always struck
me as, um, more pain than whatever other gain I
might get from Elixir), so I don't know what
"to pin" means in Elixir.

I am also confused by it being called an operator.
It appears to be an ANNOTATION, not an operator,
some sort of "hey I really meant to have an
already bound variable here" annotation.  It
certainly doesn't *act* like an operator.
If it were an operator, I'd be asking what ^X+1
meant and what ^1+X meant.

Since Erlang has two notions of equality, I
would be much happier with an optional style
rule that says "all variables in a pattern
must be new" (like patterns in Haskell, SML,
and so on) forcing you to show in the guard
which version of equality you wanted.  This
would be a pure restriction on existing
Erlang syntax; any code accepted under this
rule would also be acceptable under unrestricted
Erlang and would have the same meaning.

I note that none of the other functional
languages I use (Haskell, SML, OCaml, F#)
have any analogue of ^X and they don't need
it.

On Sun, 17 Jan 2021 at 21:18, Valentin Micic <[email protected]> wrote:

>
> > On 15 Jan 2021, at 17:35, Raimo Niskanen <
> [email protected]> wrote:
> >
> …
>
> > 1) Would the language be a better language with a mandatory pinning
> operator?
> >
> >
>
>
> I think this must always be our starting point.
> Without asking this question, we might wake up one day programming in C++
> (not that anything is wrong with that… well, other than esoteric syntax).
>
> V/
>
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.