-
Notifications
You must be signed in to change notification settings - Fork 97
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
Comment attached to include
are dropped
#645
Comments
relevant: #87 |
This is covered. In my example, |
These rules need to go into the doc that you've just PRd too! |
As was mentioned in #612 it won't be possible to place T's include comment after the Also I don't think it's a good idea to make a distinction between the "decl comment" and the "top comment". As far as rendering module
and I don't expect users to make a difference between them. Now if you start making differences with what is in the top comment and the declaration comment only when you |
So if we want to follow what @lpw25 wants in #87 (I'm personally not entirely convinced) then what we should drop is the synopsis. Here are few possibilities to ponder:
I'd be tempted by 2. |
This is what happens for modules but not what happens with module types: (** Bli *)
module type T = sig (** Bla *) end
(** Blu *)
module M : T
The problem with documentation attached to includes, is that it would be lost because no page is generated for them. I agree with your
I definitely expect it hidden when the details is closed. But more importantly, I think it should be placed after the "include" block for consistency. Currently, I see this comment has a floating comment and that can be confusing if the doc itself is vague about where it belongs (eg. the doc doesn't mention "include" because it assumes it'll be placed consistently). The HTML backend should be able to not hide the comment when the details are closed, even if it's placed after. I'm not sure about other backends. |
On that example I agree, but for me, for the reasons mentioned above, it should not be about topdoc vs decl doc. Nothing should ever be defined in these terms because the users of the declarations can't know how these were produced and the person who likely wrote them one of the other out of taste. This means that if one writes:
It should always only be about playing with the synopsis. Nothing should ever be defined in terms this was in the topdoc or in the decldoc.
Personally docstring of includes only became news to me recently, but I think the idea is that you get a short description of what to expect if you click the disclosure button. So you don't want them hidden when the details is closed (and while inconsistent it's fine to have them before for usability reasons). |
Absolutely not. The top-comment is handled separately to the decl comment until the last stage where it is used to compose the preamble (and the synopsis). This is done on purpose, see #478 (comment) About the current issue, does anyone have an opinion ? |
I think that we should always drop the synopsis of the includee. I don't think there is a need to distinguish whether the synopsis has come from the module or the signature in this case. Note that an I basically think that the comment attached to a module type is a description of the module type itself and the top comment on a signature is a description of any module that has that exact signature. Clearly a module whose type includes a module type is not equal to that module type -- so it shouldn't get the comment attached to the module type. A module whose type includes a signature is also not a module that has that exact signature -- it has a larger type which includes the contents of that type -- so it also shouldn't get the top comment of the signature. The second point is debatable, but I think that model makes sense. |
It's so debatable that I think I've changed my mind. I think users would be less surprised by the behaviour in this patch than by the one that drops the whole synopsis. So I'm fine with what is implemented here. |
I'm fine with that, but I'm not fine with making a distinction between the declaration comment and the top comment.
Then it should not :-) If there is one what's the rationale for that behaviour ? Now that we finally have clear definitions of synopses and preambles we should actually use them and that means not caring about how these get defined in the source code in terms of declaration and top docstring. Again it's likely not the same person who includes than the one who wrote the thing to include. So it will make the behaviour seemingly random to includers for absolutely no good reason. . |
The next sentence, that you elided, is:
The preamble is defined in term of the top-comment and the declaration comment. Consider that the expansion occurs before the preamble can be defined, eg. |
Well that comment precisely tells that a top-comment and declaration comment are the same. But anyways… I'm getting a bit tired of having to argue to get a consistent design for end-users. |
In the example above, the page for
M
renders like this:The comment attached to the
include
is not rendered andT
's top-comment is placed before theinclude T
folding block.I'd expect that
T
's top-comment is moved inside the folding block and the comment attached to theinclude
placed before it:The text was updated successfully, but these errors were encountered: