[erlang-questions] edoc, erlc and dialyser type spec consistency
Fri Nov 20 17:28:54 CET 2009
I agree also with Kostis, but I would also like to request that -type
declarations permit recursive data types. Recursive data types are not
really that uncommon, and are the reason I stopped using -spec/-type
Another thing I'd like to have is the ability to define a -type as some sort
of fun(...), and then in a -spec, be able to say that the spec for the
function being spec'd is the type previously defined. E.g.,
-type funtype() :: fun((args()) -> return_type()).
-spec f :: funtype ().
Instead of having to retype the spec for every function with the same
-spec f(args()) -> return_type().
> -----Original Message-----
> From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On
> Behalf Of Kenneth Lundin
> Sent: Thursday, November 19, 2009 6:03 AM
> To: Joe Armstrong
> Cc: Erlang; Richard Carlsson; Kostis Sagonas
> Subject: Re: [erlang-questions] edoc, erlc and dialyser type spec
> I agree with Kostis answers and can also inform you that we are working
> on a solution for a) below.
> The plan is:
> Edoc will then parse and use the same -spec and -type as Dialyzer.
> If a file contains both -spec/-type and edoc comments with @spec and @type
> you will have to choose which notation to use (as a compatiblity mode) for
> already existing edoc markup.
> /Kenneth Erlang/OTP Ericsson
> > My suggestion:
> > a) There should be ONE type/spec parser as part of the OTP
> > everybody should use this one and not their own
> > b) Specs and types must finish with DOT WHITESPACE.
> > c) Quoting atoms in type specs is illegal.
> > d) Function names are required (ie not optional as in edoc)
> > e) Short form of type names are legal
> > bool(), int().
> > There rules obey certain meta principles:
> > meta principle 1) "don't wear your fingers out"
> > - I want to type
> > foo(X::bool()) -> ok.
> > and not
> > foo(X::boolean()) -> 'ok'
> > meta principle 2) "optional is bad"
> > ie DOT whitespace is not optional - dropping the function
> > symbol and inferring it from the next function is bad.
> > the parser and is responsible for lager numbers
> > or really weird errors)
> > meta principle 3) "make type specs etc look like Erlang"
> > Similar syntax if possible, similar conventions. The sudden
> > of quotes, optional '.' violates the principle of least astonishment.
> > /Joe
> > ________________________________________________________________
> > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > erlang-questions (at) erlang.org
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions