[erlang-questions] encapsulating types and dialyzer

Anthony Shipman <>
Fri Sep 12 18:08:04 CEST 2008


On Fri, 12 Sep 2008 05:13:45 pm Tobias Lindahl wrote:
> > PS. I should point out that the language of types and -spec declarations
> >      is currently an EEP.  Officially, it is not part of Erlang yet.

Why do some of the types in the Erlang source have extra parentheses around 
them?
	-type(digraph() :: any()).
Is there any use for this or is it just an ornament?

>
> As Kostis points out, you are allowed to declare these remote types, but
>   currently they are not used. Of course, this will change in the future.
>
> Tobias

What could be useful to include is a "new type" feature like in Ada or 
Haskell. E.g.

-type new length() :: float().
-type new area() :: float().

Then although they are both implemented as floats you can't pass one as 
another without an error or warning.

The change to the type checking algorithm might be quite small. When comparing 
two types, if they are both new then the names must match as well as the 
structure, otherwise only do structural matching.
-- 
Anthony Shipman                    Mamas don't let your babies 
                   grow up to be outsourced.



More information about the erlang-questions mailing list