[erlang-questions] Dialyzer and record MatchSpec warnings

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Tue Feb 3 13:20:06 CET 2009


Tobias Lindahl skrev:
> 
> The quick fix is to include '_' in the specified type for all fields you 
> want to assign to '_'. A more general fix might be that Dialyzer always 
> accepts '_' for construction since match specs are quite common. We'll 
> have to think about that.

I think that Dialyzer will have trouble dealing with match specs as
a distinct entity. Personally, I often try to structure complex match
specs e.g. as

MatchHead = ...,
Guards = ...
Result = ...,
Pattern = {MatchHead, Guards, Result}

(which also seems like recommended practice judging from the docs).

For a more complex treatment of match specs, you could look at gproc:

http://svn.ulf.wiger.net/gproc/src/gproc.erl

which rewrites match spec patterns as part of using QLC
(some of it, but not all, should happen at compile-time.)

I will confess that I haven't tried running Dialyzer on gproc. (:

BR,
Ulf W



More information about the erlang-questions mailing list