type specs and mnesia selects

Paul Mineiro paul-trapexit@REDACTED
Wed Jul 8 23:59:24 CEST 2009


from the silence i assume no.

for the (search engine) record, i ended up augmenting the type specs with
sum types which included the (first few) variable atoms.  this weakens the
type enforcement in other parts of the code, and i mused having two
headers, one external and one for (mnesia) internal implementation, but
laziness kicked in.

it's not all bad ... by not allowing variable binding in the first element
of various tuple keys, i can forbid full table scans using the type
system.

cheers,

-- p

p.z. dialyzer rulz!

On Tue, 7 Jul 2009, Paul Mineiro wrote:

> folks,
>
> i was being a good citizen and adding type specifications to my records.
> this caused dialyzer to complain because in my mnesia:select/2,3,4 calls I
> am binding a member of the record to a variable (which is an atom like
> '$1') and this was violating the type spec.
>
> are there any workarounds, other than augmenting or dropping the type
> spec?
>
> -- p
>
>



More information about the erlang-questions mailing list