What use is `case` sneak- binding?

Karl Velicka karolis.velicka@REDACTED
Wed Aug 18 14:17:44 CEST 2021


Hi Michael,

Apologies if I'm just missing something obvious or I'm missing some key
context, but to me your message/question contains a lot of unfamiliar
terminology and hyperbole which makes it hard to understand what you're
getting at.

What is "sneak-binding"? Sneaky "slot machine" nature?

It would be really helpful if you could give a more concrete example of
what you dislike about case (the less ellipsis the better!), and a similar
piece of code rewritten following your suggestion (I _think_ you're making
a suggestion without message, but I'm not actually entirely sure..)

Thanks,
Karl

On Wed, 18 Aug 2021 at 13:04, Michael P. <empro2@REDACTED> wrote:

> What use is the sneaky "slot-machine" nature of
> how `case` treats pattern unboundies
>
> Does it simplify the implementation of `case`?
>
> OC, `case` has to _try_ to match the patterns and cannot
> simply dump every new binding. Unbinding on badmatch or
> repeating the matching or transferring new bindings
> after success in some subscope might complicate
> the implementation. And sounds a bit like backtracking,
> and Erlang was designed with a 'no backtracking' premise ...
> yet there cannot be any side-effects as the only expression
> allowed in patterns is 'variables', the `case` switch
> is evaluated only once anyway ... and now I have shipped
> off the brink of my tiny world.
>
> Giving `case` the '(let)' after 35 years hits "the legacy wall".
>
> What would one lose when the "slot-machine" scared
> one into some
>
>     Switch = ...,
>     Result = (fun Case(...) when ... -> ...;
>                   Case(...) when ... -> ...
>               end)(Switch),
> ?
>
> ~M
>
> --
>
> Normality is merely a question of quantity,
> not of quality.
>
> Normalität ist nur eine Frage von Quantität,
> nicht von Qualität.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210818/5819ce93/attachment.htm>


More information about the erlang-questions mailing list