Re: no function clause matching became no case clause matching exception
Mikael Pettersson <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CAM43=SNU0wmLBdKh+J=K1DvdO-9yOuc2ePCya4HCPondvW3b+A@mail.gmail.com> |
On Mon, Dec 13, 2021 at 9:46 AM Björn Gustavsson <[email protected]> wrote: > > 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. 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. /Mikael