[erlang-questions] dialyzer <-> exceptions

Andras Georgy Bekes <>
Mon May 5 16:10:53 CEST 2008


Hi,

I've just found that dialyzer is not type checking exceptions.

What I mean:
-----------------------------------------
f()->
  ok.

case catch f() of
   ok ->
      ok;
   _ ->
      nok
end,
-----------------------------------------
Here dializer approximates the type of catch f() to 'any' type, and 
therefore not complaining about the second, unreachable case.

With try-catch, things are better:
-----------------------------------------
try f() of
   ok ->
      ok;
   _ ->   %% detected as unreachable
      nok
catch
   _:_ -> %% not detected as unrechable
      something
end,
-----------------------------------------

So it approximates caught or try-caugth exception values with 'any' type 
even if no exception can occur.

My questions are: Will dialyzer type-check exceptions in the future, or 
this would imply a total rewrite of it and therefore not planned? If 
yes, when?

	Georgy



More information about the erlang-questions mailing list