[erlang-questions] dialyzer and #record vs tuple

Vincent de Phily <>
Fri Jun 7 11:23:01 CEST 2013


On Friday 07 June 2013 12:08:18 Kostis Sagonas wrote:
> There is no perfect `solution' to this .
> 
> Dialyzer works at a level where records have been expanded into tuples
> and thus records and tuples are indistinguishable between them.
> Furthermore, it makes the assumption that within a module any tuple with
> a record tag and with a size that matches some typed record declaration
> refers to the declared types. So you have two options:
> 
>   1. Use different tags for records and tuples e.g. foo_rec vs. foo (as
> you write)
> 
>   2. Do not declare types for records that for some reason or another
> you also want to have similar looking tuples (as you write, declaring
> the "union" of the types does not make much sense).
> 
>  From the two options, I personally very much prefer the first.

Thanks for confirming this, pity there's no nice way of handling that problem 
but I'll stick with option 1 for now.

Maybe when frames arrive in erlang it'll fix that issue :)

-- 
Vincent de Phily




More information about the erlang-questions mailing list