[erlang-questions] edoc documenting macros and records?

Paul Fisher pfisher@REDACTED
Mon Mar 31 19:17:13 CEST 2008


On Sun, 2008-03-30 at 20:26 -0500, Paul Fisher wrote:
> Is there any way to provide documentation with edoc for macro and record
> definitions?
> 
> From the perspective of records, the only way that i've come up to
> include the additional information regarding the names of the fields is
> the following:
> 
> %% @type therec() = {therec, field1, field2, field3}
> %%       field1 = atom()
> %%       field2 = string()
> %%       field3 = binary()
> %%
> -record(therec, {
>         field1 :: atom(),
>         field2 :: string(),
>         field3 :: binary()
> }).


I'll answer my own question in case anyone else is looking for this
information.  After looking at the edoc source, it appears that the
following works for record documentation:

%% @type therec() = #therec{ field1 = atom(),
%%                           field2 = string(),
%%                           field3 = binary()}.
-record(therec, {
        field1 :: atom(),
        field2 :: string(),
        field3 :: binary()
}).


--
paul




More information about the erlang-questions mailing list