New EEP draft: Pinning operator ^ in patterns

Richard O'Keefe raoknz@REDACTED
Sun Jan 17 13:44:34 CET 2021


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 <v@REDACTED> wrote:

>
> > On 15 Jan 2021, at 17:35, Raimo Niskanen <
> raimo+erlang-questions@REDACTED> 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210118/7a4e7ff6/attachment.htm>


More information about the erlang-questions mailing list