no function clause matching became no case clause matching exception

Björn Gustavsson bjorn@REDACTED
Mon Dec 13 09:46:14 CET 2021


On Fri, Dec 10, 2021 at 3:52 PM Frans Schneider <fchschneider@REDACTED> 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


More information about the erlang-questions mailing list