EEP8: parametrized types

French, Mike <>
Thu Dec 3 12:25:25 CET 2009


I have a minor issue with parametrized types (R13B01).
  
Using the example in the EEP:

  -type orddict(K,V) :: [{K,V}]. 

The question then becomes how to specify orddict:size/1 ?
let's try:

  -spec size( orddict(K,V) ) -> non_neg_integer().

  Error:  type variable 'K' is only used once (is unbound)
  Error:  type variable 'V' is only used once (is unbound)

The only workaround seems to be to declare another 
unparametrized version of the same type:

  -type orddict(K, V) :: [{K, V}]. 
  -type orddict()     :: [tuple()]. 

Which works, but it seems a bit excessive to require both styles of
declaration.

My suggestion would be to allow unbound type variables on the LHS of spec ?
or perhaps demote the status from Error to Warning ?

Mike



Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail
is confidential. It may also be legally privileged. It is intended only for
the stated addressee(s) and access to it by any other person is
unauthorised. If you are not an addressee, you must not disclose, copy,
circulate or in any other way use or rely on the information contained in
this e-mail. Such unauthorised use may be unlawful. We may monitor all
e-mail communications through our networks. If you have received this e-mail
in error, please inform us immediately on sender's telephone number above
and delete it and all copies from your system. We accept no responsibility
for changes to any e-mail which occur after it has been sent.  Attachments
to this e-mail may contain software viruses which could damage your system.
We therefore recommend you virus-check all attachments before opening.
Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business
Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No.
868273


More information about the eeps mailing list