[erlang-patches] tid() is not a predefined type anymore

Kostis Sagonas kostis@REDACTED
Wed Jun 2 23:55:44 CEST 2010


Per Hedeland wrote:
> Thanks a lot for this! Applied with minor tweaks to our R13B03-ish OTP.
> However seeing the actual list of predefined types for the first
> time:-), I think there are a few more of them that falls in the same
> category as tid(), and should be made module-specific for the same
> reasons:
> 
>                 {array, 0},
>                 {dict, 0},
>                 {digraph, 0},
>                 {gb_set, 0},
>                 {gb_tree, 0},
>                 {queue, 0},
>                 {set, 0},
> 
> E.g. having a predefined type queue(), which can only be defined as "The
> opaque type returned by new/0 in the OTP module called 'queue'", and
> which prevents all use of that type name in user-written modules (where
> it could otherwise exist peacefully as mod:queue()), really doesn't seem
> like a good idea to me. I won't argue this point further though.:-)

Per,

You are absolutely right about this and it is indeed my intention to 
take these out from the list of predefined types.  However, this is a 
bit tricky to do at this point (for various reasons that I will not go 
into now) and IMO it is best done when two other features are in place:

  1. The ability to write -import_type attributes (analogous to -import)
     so that one does not have to write: gb_trees:gb_tree() all over the
     place.

  2. The ability to have parameterized opaque types, e.g. set(atom())
     which is currently not possible.

The first addition is relatively easy and may happen soon. The second 
one is a significant change. When these two are in place, we will take 
out these types from the list of predefined types.

Kostis


More information about the erlang-patches mailing list