Skip to content

Manual: documentation comments#547

Merged
gasche merged 2 commits intoocaml:4.03from
lpw25:manual-doc-comments
Apr 17, 2016
Merged

Manual: documentation comments#547
gasche merged 2 commits intoocaml:4.03from
lpw25:manual-doc-comments

Conversation

@lpw25
Copy link
Copy Markdown
Contributor

@lpw25 lpw25 commented Apr 15, 2016

This patch adds a section to the language extensions page about documentation comments.

Comments welcome :-)

@Drup
Copy link
Copy Markdown
Contributor

Drup commented Apr 15, 2016

What about comments inside code (like in the middle of a function) ? Iirc, ocamldoc supports those (with the weird "literate programming" mode for `.ml files).

Otherwise, the documentation is quite clear. :)

@gasche
Copy link
Copy Markdown
Member

gasche commented Apr 15, 2016

One thing I find odd is that this new section does not mention ocamldoc at all. Given that ocamldoc is also reference in the manual, I would expect the section to reference the ocamldoc documentation and explain the distinction between them, and possibly also a backreference from the ocamldoc document ("Since 4.03, ..."). In particular, you should explicitly mention the fact that ocamldoc and the parsing of documentation comments by the compiler and by ocamldoc are different. (Is one a strict subset of the other?)

I also wonder whether we should have this as a "Language Extension". This is a section where we put everything, and it's not very easy to find for non-language-experts. Could we at least have a mention of this new section in the main part of the manual that describes the grammar of the language? Could we consider having all of it outside the "Extensions" section?

@Octachron
Copy link
Copy Markdown
Member

Concerning the interaction between label and item comments, I think it might be nice to precise that it is possible to add an item comment after the last label comments, i.e. that

type t = Label (** label *)
(** item *)

attaches the comment (** item *) to t:

type t =
  | Label [@ocaml.doc " label "][@@ocaml.doc " item "]

On this subject, it is intended that the empty comment trick on the last label

type t = Label (**)
(** item *)

does not work anymore and generates

type t =
  | Label [@ocaml.doc " item "]

?

@lpw25
Copy link
Copy Markdown
Contributor Author

lpw25 commented Apr 16, 2016

I've added a reference to ocamldoc and mentioned that the forms accepted by the compiler are a subset of the forms accepted by ocamldoc.

As for whether this should go in "Language extensions", I think it should go wherever the description of attributes goes since it is just an additional attribute syntax. Since that is currently in language extensions this section should also go in language extensions.

Concerning the interaction between label and item comments, I think it might be nice to precise that it is possible to add an item comment after the last label comments

Good idea. Done.

On this subject, it is intended that the empty comment trick on the last label

type t = Label (**)
(** item *)

does not work anymore and generates

(**)is not recognised as a documentation comment. Using (** *) works. It might also be good to support (**) specifically for this case. Feel free to make a feature request on Mantis.

@gasche gasche merged commit 9b8f068 into ocaml:4.03 Apr 17, 2016
lthls pushed a commit to lthls/ocaml that referenced this pull request Jul 9, 2021
We now want to create every `Code.t` with a correct set of inlining
arguments, so we no longer need `Inlining_arguments.unknown`, which
deferred producing the arguments until after the `Code.t` was created.
stedolan pushed a commit to stedolan/ocaml that referenced this pull request May 24, 2022
stedolan pushed a commit to stedolan/ocaml that referenced this pull request May 24, 2022
Caused by an undetected conflict between ocaml#556 and ocaml#547
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants