[erlang-questions] What is a tid()?

Per Hedeland per@REDACTED
Thu Apr 29 10:53:37 CEST 2010


Per Hedeland <per@REDACTED> wrote:
>
>Kostis Sagonas <kostis@REDACTED> wrote:
>>
>>Per Hedeland wrote:
>>> $ erlc test.erl
>>> ./test.erl:5: referring to built-in type tid as a remote type; please take out the module name
>>
>>tid() is a built-in opaque type for ETS table identifiers.
>
>Thanks - maybe it's already in the queue for an update to
>http://www.erlang.org/doc/reference_manual/typespec.html?
>
>>These cannot be redefined.
>>
>>However, the warning you have run into predates the introduction of 
>>remote types and is probably a bug.  Although one should currently use 
>>tid() to refer to ets:tid(), it should be possible to use a tid() type 
>>that one of their modules export.
>
>Well, it can't be defined in the other module anyway, can it? If so
>that's perfectly OK by me, and the error is appropriate - it's just a
>documentation omission.

Actually, I take that back - thinking about it, it seems very wrong that
this tid() should be built-in. Or rather, that it has the "global" name
tid() instead of only ets:tid(), which would be both clearer and more
logical (currently ets:tid() can't even be used). It's even listed along
with match_spec() (which *requires* the ets: prefix) in ets(3).

As far as I can see (only looking in the documentation....), all the
other built-in / "global" types are defined in terms of the language,
either as fundamental types or derived from other types - whereas tid()
can only be defined in terms of a specific module (that the module
happens to be partially implemented in the VM shouldn't be relevant).

Surely this is actually a bug, and the typespec documentation that omits
tid() is correct?

--Per


More information about the erlang-questions mailing list