<div dir="ltr">Imo you can do it with:<div><div>must(M,F,A) -></div><div><span style="white-space:pre">     </span>case erlang:apply(M,F,A) of</div><div><span style="white-space:pre">           </span>{ok, Res} -> Res;</div><div><span style="white-space:pre">          </span>_Err -></div><div><span style="white-space:pre">                    </span>io:format("Error ~p:~p(~p) ~p",[M, F, A, _Err]),</div><div><span style="white-space:pre">                    </span>exit({must, F, A,})</div><div><span style="white-space:pre">   </span>end.</div></div><div><br></div><div>In this case, you don't need to make new functions out of existing ones, and still get a nice error message.</div><img src="https://mltrk.io/pixel/2GeKwr4RZTWXCSaqKxL8?rid=2GeKwr4RZTWXCSaqKxL8" width="1" height="1" border="0"></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 27, 2017 at 11:30 AM, Karlo Kuna <span dir="ltr"><<a href="mailto:kuna.prime@gmail.com" target="_blank">kuna.prime@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">could we have something in type specifications that indicates throw case:<br><br>-spec f_name( Args ) -> .....; throw(TE | TE1 | ....).</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 27, 2017 at 11:25 AM, Attila Rajmund Nohl <span dir="ltr"><<a href="mailto:attila.r.nohl@gmail.com" target="_blank">attila.r.nohl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2017-09-27 11:08 GMT+02:00 Joe Armstrong <<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>>:<br>
[...]<br>
<span>> This turns out to be very convenient - I read many files<br>
> in my programs, so it's nice to know that must_read_file<br>
> will print a nice error message and terminate<br>
> if I give it a bad filename.<br>
><br>
> Note: I can get the program to crash by writing<br>
><br>
>    {ok, B} = file:read_file(F)<br>
><br>
> But I don't get a nice error message telling me the filename.<br>
><br>
> Any takers?<br>
<br>
</span>My problem with all kinds of very common prefixes is that it breaks<br>
function name autocompletion. Or at least makes it harder to use when<br>
I have dozens/hundreds/thousands of function names starting with the<br>
same 3-5 characters - either I have to type those 3-5 characters all<br>
the time plus any more characters to find unique prefix for<br>
autocompletion or have to autocomplete twice (one for the may/must<br>
difference, one for the actual function name). Eclipse (for Java)<br>
helpfully shows the method signature including return value and thrown<br>
exceptions - I think this problem should be solved by the IDEs and not<br>
by naming conventions.<br>
<div class="m_-988168465365646866HOEnZb"><div class="m_-988168465365646866h5">______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
</div></div></blockquote></div><br></div>
</div></div><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></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">With best regards,<div>     Roman Galeev,</div><div>     +420 702 817 968</div></div></div>
</div>