Re: no function clause matching became no case clause matching exception

Björn Gustavsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CA+yh78SehKS=qdHOy_OC6fdB+2XSP_=kBV1Zda4ufWSebjQGKQ@mail.gmail.com>
On Fri, Dec 10, 2021 at 3:52 PM Frans Schneider <[email protected]> wrote:
> The following list comprehension used to give a no function clause
> matching exception in previous version of Erlang. Now it will emit a no
> case clause matching exception. Is this expected behavior?
>
>      [(fun(a) -> "a" end)(R) || R <- [a, b, c]]

It is an unintended consequence of the change that Peti Gömöri
mentioned (inlining of funs).

It is not a bug, because exactly which type of exception an error will
raise is not documented. Furthermore, we don't recommend matching
error reasons or stack traces (with the exception of the reason
'undef'; see the Warning box in
https://www.erlang.org/doc/reference_manual/errors.html).

That said, the 'case_clause' exception is confusing, and we might fix
that in some future release, but not in OTP 24.

/Björn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
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.