Because:<br><br>Adding exception raise in this case is typical defensive programming
and it is not good practice in Erlang except pattern match with tagging.<br><br><div class="gmail_quote">On Fri, Dec 5, 2008 at 12:17 PM, Vlad Dumitrescu <span dir="ltr"><<a href="mailto:vladdu55@gmail.com">vladdu55@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Fri, Dec 5, 2008 at 12:12, Hynek Vychodil <<a href="mailto:vychodil.hynek@gmail.com">vychodil.hynek@gmail.com</a>> wrote:<br>
> I think it is worthless work add exception raise as last clause on each<br>
> function when this error occurred in same function.<br>
<br>
</div><div class="Ih2E3d">>> (w@EV001B784AC0A2)1> string:substr([], 2).<br>
>> ** exception error: no function clause matching string:substr2([],2)<br>
<br>
</div>Except it's not the same function: notice the error refers to string2,<br>
not to string.<br>
<br>
Yes, it's relatively easy to check the code and see what's going<br>
wrong, but then any documentation is redundant, as one could check the<br>
code...<br>
<br>
In any case, badarg is the standard exception thrown in similar cases,<br>
so why not be consistent?<br>
<br>
regards,<br>
<font color="#888888">Vlad<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil<br>