[erlang-questions] Force TLS v1.2

WW kingwang98@REDACTED
Sat Apr 27 22:15:10 CEST 2019

Thank you for your answer Kostis.
But will erlang crash if any other internal function call this internal function with an argument of integer() or someother term()?
-------------------------------------------------------------------------------------------------------------------------------------------------------------- ###=====================================================================###
 -spec convert_result_and_exit(any()) -> no_return().
convert_result_and_exit({error, ErrReason}) when is_binary(ErrReason)-> 
exit({error, ErrReason}); convert_result_and_exit(no_permission)-> exit(no_permission).

test() ->    convert_result_and_exit ( [1,2,3] ).     ( It is a use case , why "so they cannot be with any() as argument" ?  Where in the erlang doc defined that?)

In this case, test() will crash owing to missing the 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 ?----------------------------------------------------------------------------------------------------------------------------------------------------------------
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?
Is it  the limitation of dialyzer or  wrong in the design? What is the best solution, in my situation?
BR//Wei Wang
Best Regards W.W.(KingWang) 

    On Saturday, April 27, 2019, 4:52:29 PM GMT+2, Kostis Sagonas <kostis@REDACTED> wrote:  
 On 4/27/19 12:43 PM, WW wrote:
> But according to spec   the input of the function can be any()! It is 
> obvious the _E  should be considered, otherwise erlang will crash.
> Am I wrong?

Yes, you are.

The function is not exported; all calls to it are from within the module 
(i.e., known to dialyzer), so they cannot be with any() as argument; 
they can only be with the term types that dialyzer has inferred.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190427/17c53ce3/attachment.htm>

More information about the erlang-questions mailing list