<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"DejaVu Sans Mono";
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EstiloCorreo17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EstiloCorreo18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ES link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hi Chris,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I didn’t knew about the function of the dialyzer tool application, I read the documentation and I finally got it to work, It was a little hard because I’m using windows but I finally came with a solution:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>When I tried to start the dialyzer I got an error of it couldn’t find the PLT file etc, etc. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I read about an Environment Variable called </span><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>DIALYZER_PLT</span></b><span lang=EN-US style='color:#1F497D'> and I gave it the value </span><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>c:\Program Files\erl5.10.1\usr\PLT\countlink.plt<o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>So I built the PLT file using the common applications I use in my project<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>dialyzer --build_plt --output_plt "c:\Program Files\erl5.10.1\usr\PLT\countlink.plt" --apps stdlib kernel<o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Them I use another script to update the PLT file with my beams and at the same time get a result.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>@echo off<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>mode 100, 40<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'><o:p> </o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>dialyzer --add_to_plt -r "d:\WORK\countlink-1.0\src" --output_plt "c:\Program Files\erl5.10.1\usr\PLT\countlink.plt"<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo.<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo.<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo. <o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo ************************************************************* <o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo * Dialyzer Results *<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo *************************************************************<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>dialyzer -r "d:\WORK\countlink-1.0\src"<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>echo.<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='font-family:Consolas;color:#1F497D'>pause <o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I wonder about what for is the PLT file but I think, following my guessing that it content the necessary information of types and functions exporting and many other things.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Because I did test it excluding for example, one my beams with debug information which had an exported type, I use that type in another module included in the PLT and I got an error of undefined type, then I include it again and resulted in no errors.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>That’s very good the Dialyzer application, but I still think that the compiler should be aware of that minor details, maybe not something like unreachable code detection or unnecessary testing like Dialyser do, still it could also do that, Microsoft CShard Compiler does it, ups sorry about that ;).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Well I hope in the future the community fix or adds that little things to the Erlang compiler that is so important (I think one of the most important modules).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Ivan.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:ES'>De:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:ES'> Chris King [mailto:colanderman@gmail.com] <br><b>Enviado el:</b> domingo, 11 de agosto de 2013 11:27<br><b>Para:</b> erlang-questions@erlang.org; Ivan Carmenates García<br><b>Asunto:</b> Re: [erlang-questions] Unlike behavior in -spec and type importing<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>Hi Ivan,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>On Sun, 11 Aug 2013 11:14:16 -0400, Ivan Carmenates García <</span><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><a href="mailto:co7eb@frcuba.co.cu"><span lang=EN-US>co7eb@frcuba.co.cu</span></a></span><span lang=EN-US style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>> wrote:<o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 6.0pt;margin-left:0cm;margin-right:0cm;margin-bottom:4.8pt'><p class=MsoNormal><span lang=EN-US>I check the source of application module to see if the start_type() type was exported and it is not.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>And my module compiles well, and even I changed to StartType :: unknown_module: unknown_type() type and it still compiles,</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>It seems that there are no type checking outside of the module.</span><o:p></o:p></p></blockquote><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>Are you using Dialyzer to check types? The Erlang compiler itself does not perform typechecking. You can run Dialyzer (included with OTP) on your source code like this:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>$ dialyzer --src <source code directory><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>or, if you compile your code with debugging enabled, you can run it like this:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>$ dialyzer <object file directory><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>In addition to inferring types, Dialyzer will check that code adheres to -spec declarations, and it will warn about unexported types.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"DejaVu Sans Mono","serif";mso-fareast-language:ES'>Note that you have to run Dialyzer on *all* your modules, as it only sees the modules you tell it about, and those whose specifications have been explicitly stored in its "PLT" database (by default erts, kernel, and stdlib).<o:p></o:p></span></p></div></div></body></html>