[erlang-questions] spec( status
Kostis Sagonas
kostis@REDACTED
Thu Jan 15 13:21:59 CET 2009
Tony Rogvall wrote:
> Hi list!
>
> What is the current status on how to use the function type specs?
>
> I have seen several versions in the stdlib code!
>
> from string.erl:
>
> -spec sub_string(string(), pos_integer(), pos_integer()) -> string().
>
> gb_trees.erl (with comment)
>
> %%-spec(empty/0 :: () -> gb_tree()).
>
> lists.erl:
>
> -spec(append/2 :: ([T],[T]) -> [T]).
>
> What is the problem here???? What should I use to be a modern Erlang
> programmer?
There is no problem. It's just software evolution. To be a modern
Erlang programmer you need to use the first one (the one from string).
The second one is just a comment (no spec). The third is just something
that has not been cleaned up at the time when R12B-5 was released. Now
it has.
> Of course I would like my type spec work to pay. Are there any edoc/
> doxygen stuff that take any of the formats?
Edoc will be able to take the 1st one into account. This has not
happened yet, but it will.
> What/Which formats do dializer use?
Currently both the first and the third (for backwards compatibility).
As I wrote, the second is a comment.
> I would expect that at least the stdlib to be normalized to one
> notation, why not spend and hour or two to fix it?
Believe me it takes way more than an hour or two, but it has been fixed
in the pre-release of R13.
Kostis
More information about the erlang-questions
mailing list