<html><head></head><body><div class="ydp61617f1dyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div><div>Will it be the only solution that I exported that function even it is not used by outside? Called exported internal function?</div><div><br></div><div class="ydp61617f1dsignature">Best Regards
W.W.(KingWang)</div></div>
<div><br></div><div><br></div>
</div><div id="yahoo_quoted_7336218533" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Saturday, April 27, 2019, 10:15:10 PM GMT+2, WW <kingwang98@yahoo.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv4534017577"><div><div class="yiv4534017577ydpc2014d25yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div><div>Thank you for your answer Kostis.</div><div><br clear="none"></div><div>But will erlang crash if any other internal function call this internal function with an argument of integer() or someother term()?</div><div><br clear="none"></div><div>--------------------------------------------------------------------------------------------------------------------------------------------------------------</div><div><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> ###=====================================================================###</span><br clear="none" style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> -spec convert_result_and_exit(any()) -> no_return().</span><br clear="none" style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> %%% </span><br clear="none" style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> ###=====================================================================###</span><br clear="none" style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">convert_result_and_exit({error, ErrReason}) when is_binary(ErrReason)-> </span><br clear="none" style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">exit({error, ErrReason});</span></span></div><div><span><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> convert_result_and_exit(no_permission)-> exit(no_permission).</span></span><br clear="none" style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"></span><br clear="none"></div><div><font color="#26282a">test() -></font></div><div><font color="#26282a"> convert_result_and_exit ( [1,2,3] ). ( It is a use case , why "<span><span style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">so they cannot be with any() as argument</span></span>" ? Where in the erlang doc defined that?)<br clear="none"></font></div><div><font color="#26282a"><br clear="none"></font></div><div><font color="#26282a">In this case, test() will crash owing to missing the <span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">convert_result_and_exit(_E) -> exit({error, <<"Unknown reason">>}). I do not want it crash, I need a quiet exit (catch it afterwards)instead, will that be possible ?</span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">----------------------------------------------------------------------------------------------------------------------------------------------------------------</span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><br clear="none"></span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">The question is : Why dialyzer could not detect the internal non-exported spec ? Or Erlang module interal function should not have any spec at all , because dialyzer doesn't care?</span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><br clear="none"></span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">Is it the limitation of dialyzer or wrong in the design? What is the best solution, in my situation?</span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"><br clear="none"></span></span></font></div><div><font color="#26282a"><span><span style="color:rgb(38, 40, 42);font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">BR//Wei Wang</span></span></font></div><div><br clear="none"></div><div class="yiv4534017577ydpc2014d25signature">Best Regards
W.W.(KingWang)</div></div>
<div><br clear="none"></div><div><br clear="none"></div>
</div><div class="yiv4534017577yqt8588142334" id="yiv4534017577yqt90297"><div class="yiv4534017577yahoo_quoted" id="yiv4534017577yahoo_quoted_6495533781">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Saturday, April 27, 2019, 4:52:29 PM GMT+2, Kostis Sagonas <kostis@cs.ntua.gr> wrote:
</div>
<div><br clear="none"></div>
<div><br clear="none"></div>
<div><div dir="ltr">On 4/27/19 12:43 PM, WW wrote:<br clear="none">> But according to spec the input of the function can be any()! It is <br clear="none">> obvious the _E should be considered, otherwise erlang will crash.<br clear="none">> <br clear="none">> Am I wrong?<br clear="none"><br clear="none">Yes, you are.<br clear="none"><br clear="none">The function is not exported; all calls to it are from within the module <br clear="none">(i.e., known to dialyzer), so they cannot be with any() as argument; <br clear="none">they can only be with the term types that dialyzer has inferred.<div class="yiv4534017577yqt4578846133" id="yiv4534017577yqtfd23646"><br clear="none"><br clear="none">Kostis<br clear="none"></div></div></div>
</div>
</div></div></div></div></div>
</div>
</div></body></html>