[Erlang Forums] [Erlang/OTP Proposals/Proposals: RFC] Re-visiting EEP-0055

zxq9 zxq9@REDACTED
Mon Apr 25 18:21:19 CEST 2022


On 2022/04/26 0:45, Austin Ziegler wrote:
> That said, it took me a *long* time to understand `=:=` because it’s a 
> complex, compound sigil (not used _that_ frequently) that I’ve never 
> seen in any other language (and I know quite a few). To _me_, `^Value -> 
> …` is clearer than `NewValue when Value =:= NewValue`. But that’s me.

Sorry, but no.

One of the only two places you might do what you wrote above is in a
lambda, which is the whole thing about shadowing VS matching in lambda
heads -- which apparently nobody has caught on to yet but I keep trying
to mention is the original sin here to begin with:

   foo(Value) ->
       Blah =
         fun
           (V) when V =:= Value -> foo();
           (_)                  -> bar()
         end,
       Blah(V).

The other place you *might* do that (but almost never would if you have
a half-decent design to your data) is if you are trying to do a multi
match on a common value in an argument list entering a function and
at least one of the values is buried in a larger structure like a map
or binary (so the matching procedure will perceive one of them as
unassigned). I forget the details of this particular case, but the
compiler tells you whenever this occurs, and it is rare enough that I
can quite happily say that remembering the rules of when this can
occur is something I never have to do.

Anyway, two cases, one is pretty obvious, somewhat common, and has an
obvious and *simplifying* solution (have matching in lambda heads
instead of shadowing), and the other case is pretty rare in practice
but can already be solved with guards (and could also be solved in a
*simplifying* way by making the specific matching procedure that fails
in the odd case work as expected -- though IIRC the reason it doesn't
is some efficiency tradeoff, so whatever, who cares).

The point is "leave 'well enough' alone" and your example illustrates
enough unfamiliarity with the language you want to change that I just
don't get the point of even pushing for it other than for *your*
personal comfort in a language that you already stated is not your main.

As for you not grokking the point of == VS =:= ... it is really hard
to even see this as a serious argument. It's troll-level nonsense and
brings us right back to plenty of people not having any clue what the
little ^ is supposed to imply in Erlang. Just a "right back at'cha"
moment there.

A: "I don't understand what ^ is."
B: "I don't understand what =:= is."
A: "It just means 'match', AKA type+value comparison."
B: "Oh. Well, if you don't accept ^ into your language you're hateful."
A: "Wait... what?!?"

-Craig


More information about the erlang-questions mailing list