no function clause matching became no case clause matching exception

Mikael Pettersson mikpelinux@REDACTED
Mon Dec 13 11:15:44 CET 2021

On Mon, Dec 13, 2021 at 9:46 AM Björn Gustavsson <bjorn@REDACTED> wrote:
> 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.

I think this is unfortunate. The language specifies different errors
for different
cases, e.g. badmatch, case_clause, function_clause, and I think the error
implied by the original source should be preserved even if the compiler inlines
and rewrites code. If this is not the case there is no reason for the
language to
pretend to have this distinction.


More information about the erlang-questions mailing list