New EEP draft: Pinning operator ^ in patterns

Fri Jan 22 12:00:19 CET 2021


On Thu, 21 Jan 2021 23:55:04 +0100
Loïc Hoguin <essen@REDACTED> wrote:

> You say ^ indicates that the match is intentional, and in a perfect
> world perhaps that's true, but in the real world you'll also end up with
> misplaced ^ that should not be matches at all, as some of your examples
> show. So while you do increase the confidence that the match was

That was what C9 was hinting at

> intended, it's not necessarily the case. Ultimately all it says is "this
> variable is already bound".

What really increased my liking for the idea EEP 55 is based on was the realisation that, in a pattern, boundies and unboundies simply look the same:

    ... = 1, % Hidden in the meaning ('context'). Possible leading %.
    {A, B} = tootoople(), ...

I find two different things looking the same contradictory. (Think of all the awkwardness in dealing with twins ;-) Until someone proves to me some "need to [...] introduce a new shadowing binding" (EEP 55), I can only see this, and the following:

> As a result, the ^ alone does not convey much information.

"When code is being modified to add a feature or fix a bug, a programmer might want to introduce a new variable for a temporary result. In a long function body, this risks introducing a new bug." (EEP 55)

"Yes! And no!" (Edmund Blackadder)

True, but incomplete (I) What bug? and why?

This reminds me of manifestly (statically) typed variables. You help the compiler tell you about errors and you avoid and quicklier find many. The compiler works for you, nice! But lo! you also work for the compiler: more focus is given as to the 'what', taking from the 'why', call it the "larger what", the "business logic", "domain blah ...

Last time I investigated, it sounded like swapping many small bugs for a few more horribly crawly things.

Should the Borg pop by, thell them I told to tell them to "analyse this!"



To be tolerant one needs to be intolerant of intolerance.

Um tolerant zu sein muss man intolerant gegenüber Intoleranz sein.

More information about the erlang-questions mailing list