Maybe they should, but there's a large cost to that and that's not how things actually work today. Sometimes bad inputs will crash, but only because they are forced to. <br><br>On Sunday, February 9, 2014, Heinz Nikolaus Gies <<a href="mailto:heinz@licenser.net">heinz@licenser.net</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I somewhat disagree on that point. Shouldn’t functions crash given badly typed inputs? That sounds like the reasonable thing to to when following the fail early paradigm and I always got the impression a lot of the functions in the core libraries happily die a tragic death if a wrong input comes too close to them.<br>
<div>
<div>---</div><div>Cheers,</div><div>Heinz Nikolaus Gies</div><div><a href="javascript:_e(%7B%7D,'cvml','heinz@licenser.net');" target="_blank">heinz@licenser.net</a></div><div><br></div><br>
</div>
<br><div><div>On Feb 9, 2014, at 11:43 PM, Bob Ippolito <<a href="javascript:_e(%7B%7D,'cvml','bob@redivi.com');" target="_blank">bob@redivi.com</a>> wrote:</div><br><blockquote type="cite">If you assume that all functions have undefined behavior when given incorrectly typed inputs, it's perfectly consistent. Erlang code tends to assume correctly typed input because it's simpler to implement and the types can often be checked mechanically with tools such as dialyzer.<br>
<br>On Sunday, February 9, 2014, Yoshihiro Tanaka <<a href="javascript:_e(%7B%7D,'cvml','hirotnkg@gmail.com');" target="_blank">hirotnkg@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Right. I guess I'm questioning the accuracy of the document.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 9, 2014 at 7:52 PM, Siraaj Khandkar <span dir="ltr"><<a>siraaj@khandkar.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is just a surprising side effect of dynamic typing. To perform the<br>
append, the left list is traversed and the right is just blindly used as<br>
a tail, so it is never introspected and thus never has an opportunity to<br>
crash.<br>
<div><br>
<br>
On 2/9/14, 10:30 PM, Yoshihiro Tanaka wrote:<br>
> Hi,<br>
><br>
> In the document :<a href="http://www.erlang.org/doc/man/lists.html#append-2" target="_blank">http://www.erlang.org/doc/man/lists.html#append-2</a><br>
> It says:<br>
> append(List1, List2) -> List3, List1 = List2 = List3 = [T], T = term.<br>
><br>
> But considering the following behavior, it does not look correct:<br>
><br>
> 1> [] ++ undef.<br>
> undef<br>
> 2> undef ++ [].<br>
> ** exception error: bad argument<br>
> in operator ++/2<br>
> called as undef ++ []<br>
> 3> [a,b] ++ undef.<br>
> [a,b|undef]<br>
> 4><br>
><br>
><br>
> Thoughts ?<br>
><br>
><br>
> Thank you<br>
> Yoshihiro<br>
</div></blockquote></div><br></div></div>
</blockquote>
_______________________________________________<br>erlang-bugs mailing list<br><a href="javascript:_e(%7B%7D,'cvml','erlang-bugs@erlang.org');" target="_blank">erlang-bugs@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-bugs" target="_blank">http://erlang.org/mailman/listinfo/erlang-bugs</a><br>
</blockquote></div><br></div></blockquote>