-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify the difference between empty map, none, and hidden in EEP 48 #33
Conversation
This aligns the EEP with the usage of those values in Erlang/OTP XML, EDoc, and Elixir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to recall how all this works for Erlang/OTP.
As far as I can tell the way that I have implemented it is that none
and #{}
are for all intents and purposes equivalent. none
is used when the docs are created automatically from the AST, while #{}
is created when the docs are generated by erl_docgen. I found the previous discussions about this and I can't really make sense of why past me thought that there was a significant difference between the two.
How does elixir and ex_doc generate/consume these values?
Below follows a description of what Erlang/OTP does:
shell_docs
shell_docs renders this:
For modules and doc entrues:
#{ <<"en">> -> ... }
-> render docs#{ <<"se">> -> .., <<"pr_BR">> -> ...}
-> render "first" docs#{}
-> render docs with text "There is no documentation for ?MODULE/?ENTRY"none
-> render docs with text "There is no documentation for ?MODULE/?ENTRY" (created bycode:get_doc
)hidden
-> render docs with text "The documentation for ?MODULE is hidden. This probably means
that it is internal and not to be used by other applications."
erl_docgen
erl_docgen generates this:
For ModuleDocs
#{ <<"en">> -> ... }
-> normal docshidden
-> For modules that are internal
For doc entries:
#{ <<"en">> -> ... }
-> normal docs#{}
-> for entries that are documented, but without any text. Only entries of the typetype
can create an empty map.
A hidden
doc entry is just left out of the doc entry list. hidden
or none
are never used.
code:get_doc/1
code:get_doc/1
generates this for any module that does not have a code chunk:
For ModuleDocs
none
-> There is no documentation
For doc entries:
none
-> There is no documentation- If there is a
-spec
in the AST, we create a signature from that.
entry | ||
An empty map may be given when the entry has no documentation but the | ||
entry must still be listed. Alternatively, the atom `none` must be | ||
used when the entry has no documentation and it must not be listed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When describing the same mechanism for Doc
we use the words public
and reference index
instead of listed
. Can we rephrase this to use the same terminology?
@garazdawi I am totally fine with treating |
As I understand it, the problem case was when:
Ultimately, this lead to the module as a whole not getting an HTML page generated. erlang/otp#5205 changes EDoc to return In comparison to shell_docs, as far as I understand:
|
@erszcz correct. The point though is that we made it so ExDoc treats |
Indeed, one of the values seems redundant. |
So to recap, that would mean that both While ModuleDoc = Erlang treats doc chunk missing as if ModuleDoc = |
I think the
|
We are all on the same page. I will close this PR and update ExDoc. We can probably close the OTP PR for Edoc too. Thanks! |
This not how
This is the same return you get if you put a function that actually does not exist:
I wonder if we should start generating |
Oops, misclick. Sorry. |
This aligns the EEP with the usage of those values in Erlang/OTP XML,
EDoc, and Elixir.