Hi Kostis:<br><br>Wow that was fast :-). Speaking of fast, am I imagining things or is the<br>dialyzer noticeably faster when using it in R12B4 than R12B3,<br><br><br>Thanks for the quick response. I should have been a bit more thorough in reporting<br>
the command line options I used, I'm sorry about that. My gut reaction is to turn<br>on the strictest possible checking in any static analysis tool, I'd much rather sweat<br>it now than be chasing run time errors later.<br>
<br>Bill M.<br><br><div class="gmail_quote">On Sat, Nov 15, 2008 at 3:39 AM, Kostis Sagonas <span dir="ltr"><<a href="mailto:kostis@cs.ntua.gr">kostis@cs.ntua.gr</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;">
Bill M. wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello All:<br>
<br>
Please consider the following functions<br>
(which perform a sieve of Eratosthenes to find all primes < N where N > 1,<br>
</blockquote>
<br>
... CODE OMITTED ...<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Running the dialyzer from R12B4 gives (Note, I had to make the lines<br>
in the code snippet above fit in 80 columns or less, so the line<br>
number might be off):<br>
<br>
test.erl:20: Type specification test:list_primes_helper/2 ::<br>
(MaxFactor::pos_integer(),PrimeCandidates::[pos_integer()]) -> [pos_integer()] is a subtype of the success typing:<br>
(pos_integer(),[integer()]) -> [integer()]<br>
</blockquote>
<br>
Well, running dialyzer on your code will not give you this.<br>
You will only get this if you explicitly turn on the option -Woverspecs.<br>
You should not.<br>
<br>
>From the options that are turned off by default, the only two options we recommend turning on are: -Wunmatched_returns and -Wunderspecs<br>
<br>
The remaining options are mainly for developers & debugging.<br>
(The manual could have been more explicit regarding this point - it will be in the next version.)<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
My guess is dialyzer didn't accurately guess the type of lists:seq(2,N).<br>
</blockquote>
<br>
Your guess is correct, but it also has to do with the fact that the spec for this function is not as refined as it can be. In R12B-4, it reads:<br>
<br>
-spec(seq/2 :: (integer(),integer()) -> [integer(),...]).<br>
<br>
and it nowhere specifies that if you feed it two pos_integer() it will return a list of pos_integer().<br><font color="#888888">
<br>
Kostis<br>
</font></blockquote></div><br>