[erlang-questions] Maps branch and disclaimers

Jesper Louis Andersen <>
Wed Oct 30 16:42:03 CET 2013


On Wed, Oct 30, 2013 at 4:13 PM, Chris King <> wrote:

> Thanks for listening.  I come from the OCaml world which *almost* has
> heterogeneous maps done right (its object types); AFAIK no other language
> does (beside SQL), hence why I am so engaged :)


My guess would be that there is a subtyping construction at play here. And
they usually require both covariance and contravariance in input/outputs to
functions. Luckily, the dialyzer is able to be more lenient and can just
give up typing if possible and call it a map(). But that will not buy you
much static verification, sadly.

What one could do is to handle the homogenous case well in the dialyzer.
This should be fairly straightforward if one can provide a witness that
only homogenous values gets added. This doesn't solve the heterogenous case
though.


-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131030/7e258941/attachment.html>


More information about the erlang-questions mailing list