[erlang-questions] A dialyzer question on improper list detection of list appends
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Thu Aug 19 22:07:43 CEST 2010
On Thu, Aug 19, 2010 at 9:46 PM, Kostis Sagonas <kostis@REDACTED> wrote:
>
> It's really very very simple.
>
> Pay attention to the fine line of the warning: "Cons will produce ..."
> In the ++ case there is no explicit cons involved ;-)
>
> Now, can I have my million dollars? :)
Oh, hehe. That makes sense.
> Seriously though, the core of the problem is that you are making an
> assumption which does not hold. You are implicitly assuming that dialyzer is
> a tool which is *sound for correctness*: i.e., capable of detecting a
> complete set of warnings (of a certain kind). It is NOT.
Ah, right. There is a strong similarity to Type I and Type II errors
in statistics here. You can have:
The tool says Yes (no warnings present) or No
The code may have a defect or not.
So there are 4 outcomes: Yes/Defect, No/Defect, Yes/Correct,
No/Correct. It is interesting how the dialyzer is different from a
type checker in that respect, because it puts the emphasis differently
and tries to eliminate outcomes differently. In particular the *sound
for defect detection* means that the No/Correct should be 0. Contrast
with a type checker which may fail to type check a program which has
no defects at all, due to the type system being too weak. On the
contrary the type checker seem to have the upper hand in the
Yes/Defect case, where it makes a mistake rarer than a tool like the
dialyzer.
--
J.
More information about the erlang-questions
mailing list