<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 12, 2016 at 2:02 PM, zxq9 <span dir="ltr"><<a href="mailto:zxq9@zxq9.com" target="_blank">zxq9@zxq9.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It probably should crash there, IMO. There are other places in the stdlib where you can drop invalid data grenades by passing wrong types, too. I guess there isn't a super convenient way to check this, though -- so maybe it is a tradeoff made in the interest of performance.</blockquote></div><br></div><div class="gmail_extra">It is an instance of positive/negative testing or type I/II errors:<br><br></div><div class="gmail_extra">* Positive polarity: if we supply valid preconditions to a function, its postcondition is valid<br></div><div class="gmail_extra">* Negative polarity: if we supply invalid preconditions to a function, it rejects the input<br><br></div><div class="gmail_extra">They are duals, and in a "perfect" function, they coincide: Any input is either accepted or rejected based on the input according to the specification. There is no risk of valid input being rejected or invalid input being accepted.<br><br></div><div class="gmail_extra">What Kostis says is arguably true: most of the specifications in Erlang's stdlib only concerns itself with the positive variant, and makes no claims about the negative variant. This is often true in many programming languages.<br><br></div><div class="gmail_extra"><br clear="all"><br>-- <br><div class="gmail_signature">J.</div>
</div></div>