[erlang-questions] How to code against an interface rather than an implementation?
Fri Aug 9 16:07:37 CEST 2013
On 08/09/2013 03:58 PM, Chris King wrote:
> On Fri, Aug 9, 2013 at 8:58 AM, Loïc Hoguin <> wrote:
>> Whether Dialyzer can do that or not is a bit irrelevant, as this kind of
>> error is quickly apparent when your tests immediately fail.
> Eh, that argument can apply to most things a static analyzer checks.
> The point of a static analyzer is to catch these kinds of errors
> without having to write formal tests.
A static analyzer cannot be used in place of tests. They're
complementary. It's even more true in a dynamic language like Erlang
where the static analyzer power is limited, *but* applies to all
As an example that comes immediately to mind, heard from discussions, in
this case about Haskell, the static analyzer can tell you the program is
correct, but when you test it it blows up because it ran out of memory.
If your program passes static analyzing, that's great! But you still
have no idea if the program will actually work, because you didn't test it.
The reverse example is of course the static analyzer telling you about
things you didn't think of testing.
So use both Dialyzer *and* tests if you want solid programs. Not one or
More information about the erlang-questions