[erlang-questions] Refactoring for edoc

Pierre Fenoll pierrefenoll@REDACTED
Thu Jan 12 15:00:04 CET 2017


Instead of rewriting everyone's code, my vote is on adding an option to Edoc
that would pretty print specs as if they were written using `when`.

Here is a mix of the two styles, as an example:
http://erldocs.com/current/edoc/edoc_lib.html?i=5&search=edoc#edoc

Note to self: fix that bug where instead of `[term()]` it should say
`proplist() = [term()]`!


Cheers,
-- 
Pierre Fenoll


On 12 January 2017 at 14:36, Ilya Khaprov <ilya.khaprov@REDACTED>
wrote:

> Hello
>
>
>
> Why it generates different docs anyway?
>
>
>
> Regards,
>
> Ilya
>
>
>
> *From: *Vance Shipley <vances@REDACTED>
> *Sent: *Thursday, January 12, 2017 04:27 PM
> *To: *erlang-questions <erlang-questions@REDACTED>
> *Subject: *[erlang-questions] Refactoring for edoc
>
>
> We've recently discovered that edoc generates much nicer documentation
> when you write type specifications using `when` such as:
>
>      -spec example(Number) -> {ok, Result} | {error, Reason}
>           when  Number :: pos_integer(), Result = integer(), Reason ::
> term().
>
> ... rather than the more obvious:
>
>      -spec example(Number :: pos_integer()) -> {ok, Result ::
> integer()} | {error, Reason :: term()}.
>
>
> So the question becomes how can we easily refactor all of our type
> specifications to use the former method?  Is there a refactoring too
> well suited to this job?
>
> --
>      -Vance
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170112/985f76d6/attachment.htm>


More information about the erlang-questions mailing list