Re: What use is `case` sneak- binding?

Karl Velicka <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CANxL2L70MDhqcrg5yxMDdcW59V3utLH2je=W_mX_jP70Tp7mJQ@mail.gmail.com>
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. <[email protected]> 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.
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.