<div dir="ltr">The point of leaving it as undefined behaviour is so that the specification of case clauses is free from any hardwired assumptions about what is the right thing to do if there is no match.<div><br></div><div>This is both in order to let the Core Erlang spec be decoupled from any particular implementation of Erlang or any other language using Core Erlang, now or in the future, and to force the actual behaviour to be expressed as explicit code that can be processed by tools rather than being baked into the behaviour of the case switch (meaning that all tools would need to know about it, add extra code for it, and get it right every time).</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><br> /Richard</div></div>
<br><div class="gmail_quote">2018-01-19 11:48 GMT+01:00 Anthony Ramine <span dir="ltr"><<a href="mailto:n.oxyde@gmail.com" target="_blank">n.oxyde@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It is undefined behaviour from Core Erlang's POV to have a value that doesn't match against any case arm. There are other similar UB cases, such as a Core Erlang clause guard not evaluating to a boolean.<br>
<br>
See the spec for more details.<br>
<br>
<a href="https://www.it.uu.se/research/group/hipe/cerl/doc/core_erlang-1.0.3.pdf" rel="noreferrer" target="_blank">https://www.it.uu.se/research/<wbr>group/hipe/cerl/doc/core_<wbr>erlang-1.0.3.pdf</a><br>
<div class="HOEnZb"><div class="h5"><br>
> Le 19 janv. 2018 à 11:45, Loïc Hoguin <<a href="mailto:essen@ninenines.eu">essen@ninenines.eu</a>> a écrit :<br>
><br>
> Hello,<br>
><br>
> A short discussion about exceptions left us wondering why generated Core Erlang code always has a catch-all clause for things that don't match? Is it so it can throw a specific exception? And what would happen if the catch-all was missing and the input failed to match?<br>
><br>
> Cheers,<br>
><br>
> --<br>
> Loïc Hoguin<br>
> <a href="https://ninenines.eu" rel="noreferrer" target="_blank">https://ninenines.eu</a><br>
> ______________________________<wbr>_________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br>
______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>