<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">In Elixir syntax, with variables
getting rebound in all source code it makes sense that Elixir
needs the pin operator ( ^ ) to say "Hey, this is different, this
isn't the imperative programming variable assignment [match] you
are accustom to!".<br>
<br>
Erlang is different, with clearly immutable variable data. A
consistent variable name in the source code without a syntactic
sugar ^ prefix helps to prevent extra work changing unrelated
source code in the future as source code changes. The variable
name is always referred to as the same name in the same way, to
refer to the same data. That sameness helps developers understand
the source code and adding a prefix would obscure the variable
name while attempting to communicate that matching on a variable
is somehow different from normal, though it is very normal in
Erlang.<br>
<br>
Matching is very important in Prolog too, with Erlang syntax being
naturally similar. A pin operator hasn't been necessary in Prolog
syntax, though the matching gets more complex in Prolog (solving
rubik's cubes with short examples and other amazing things).
There isn't a clear benefit to adding the Elixir pin operator to
Erlang, just like there wouldn't be a benefit to adding it to
Prolog.<br>
<br>
Best Regards,<br>
Michael<br>
<br>
On 12/24/20 12:10 PM, Richard Carlsson wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANKG3zkza9nxmOBKFn3tFY3R5tODtcFo+ff75no7B47O4YzCPQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<div dir="ltr">The ^ operator allows you to annotate already-bound
pattern variables as ^X, like in Elixir. This is less error
prone when code is being refactored and moved around so that
variables previously new in a pattern may become bound, or vice
versa, and makes it easier for the reader to see the intent of
the code.
<div><br>
</div>
<div>See also <a href="https://github.com/erlang/otp/pull/2951"
moz-do-not-send="true">https://github.com/erlang/otp/pull/2951</a><br
clear="all">
<div>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature"><br>
</div>
<div class="gmail_signature"
data-smartmail="gmail_signature">Ho ho ho,</div>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature"><br>
/Richard & the good folks at WhatsApp</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>