[erlang-questions] Type def and spec syntax

Robert Virding rvirding@REDACTED
Sun Oct 2 00:56:21 CEST 2016


Is there any better documentation of type defs and specs than that which
occurs in the Erlang Reference manual? If so where is it?

I am trying to define an equivalent type/spec syntax for LFE so I am going
through the valid syntax then trying to work out what they mean. And there
is a lot of strangeness from simple things like the predefined type names
are 'reserved' so this is valid:

-type atom(X) :: list(X).

(whatever it means) to much more strange things like:

-spec foo(Y) -> integer() when atom(Y).
-spec foo(Y) -> integer() when atom(Y :: integer()).

(whatever they mean) neither of which are mentioned in the docs.

So is there a more complete and understandable documentation some where?

Robert

P.S. I am a bad boy with types and really only use specs for saying a
function never returns to keep dialyzer quiet. :-)

-spec generate_a_foo_error(any()) -> no_return().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161002/8692a3bf/attachment.htm>


More information about the erlang-questions mailing list