-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[WIP] Documentation comments #37
Comments
Have you seen golang comments? It looks easy to write and read. Also there is a tooling that generates static web site from source code with all documentation. |
ok so here is some summary of what we came up with on discord server:
or subsection like:
so doc comment for add function could look like this:
|
@jakubbinter I like that approach, just a few small comments:
|
I agree that we could make summary optional. I'm neutral about params and parameters |
The names i proposed were the same as in c# because of convinience, it doesn't mean i want these names exactly, it means i would like sections that contain the same information as the proposed sections do in c# |
In my opinion a very unloved but important part of language design would be documentation comments. We read docs all day, we love good documentation but we usually dislike writing it. We could definitely help that a little in multiple ways.
Summary of the main styles
C# uses XML, which is horrific in multiple ways:
cref
.see
,paramref
,typeparamref
, ... Damn it, let me just usesee
everywhere!Rust uses Markdown, which has many advantages, but also a few drawbacks:
# Arguments
section, and in there will be an enumeration of some sort.Many languages use javadoc-style tags:
<pre>
HTML tag, bringing in the same escaping problem as with C# XML docs.My thoughts
I think that XML definitely has to go. I really like the idea of not having to write extra documentation outside of my module, so I'm leaning towards the Rust-way, having full markdown support. But I think that the Rust format could be helped a bit with some convenience syntax. I don't think it would be a horrible thing to add javadoc tags to markdown.
Also executing code in comments is a really great way to not have outdated examples get left in the docs, I'm a fan of that.
Syntax
Since the current comment syntax is
//
, we could make doc comments something similar, like:///
,/!
, ... Personally I'm fine with///
, but you can suggest a syntax in the comments.The text was updated successfully, but these errors were encountered: