New EEP draft: Pinning operator ^ in patterns

Richard Carlsson carlsson.richard@REDACTED
Wed Jan 20 21:36:08 CET 2021

Den ons 20 jan. 2021 kl 07:18 skrev zxq9 <zxq9@REDACTED>:

> A second somewhat silly thing about this is the attitude of "Oh, well,
> fortunately in Erlang the '^' character was free to use so we'll just
> use it!" without considering that this will also remove it from the list
> of available characters for at least a decade even if you added it in
> the next release and removed it immediately afterward.

Please trust me on this, that I've been tempted various times over the last
decades to suggest picking ^ for one or other possible operator, but never
found a use that was sufficiently motivated to steal one of the available
characters. In this case I think it's motivated. And what I meant was that
we were lucky enough that we don't have to pick a different symbol than the
one used in Elixir, because it makes it easier for people to keep track of
what it means.

This character
> actually *is* used as an operator in many languages and notations for
> exponentiation.

Yes, and in C (and all that inherit from C) it means xor. It doesn't have a
common enough meaning across programming languages that I find it a strong
argument against avoiding its use, and it works very well as a visual
indicator saying "the one above". Indeed, if any other symbol had to be
used, I'm not sure this annotation would work quite as well as it does.


> "Will this make Erlang a better language?"
> No. It will make it harder to understand because people will be
> surprised when they see what looks like a random typo in the code
> because this silly convention has so few use cases.

I really don't think so. It is not used often enough that the code is
littered with it, but most modules contain a couple of them. And the thing
that really throws people off today is that they exist, but they're
invisible, and yet they can be a key point in an algorithm. Making them
visible is a useful thing.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list