godoc is simple and easy to use, but if it supported @arg, the generated document would be more clear.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Documentation can either be plain text, or can have an officially defined way to reference elements in code. Plain text reads like sentences, which according to the documentation at golang.org is a good thing. Unfortunately, the current design makes all of the following difficult to impossible:
1. Parameter hints in an IDE
2. Automatic rename refactoring algorithms which update the corresponding documentation without worrying about arbitrarily replacing unrelated text that happens to use the same word
3. Fully cross-linked documentation
The online documentation for Go packages isn’t the most unpleasant I’ve had to use (that goes to a company whose NDA prevents me from publicly stating a negative review of their documentation, a decision I’m convinced is in place because they know how bad it is). Nevertheless, it was a frustrating experience and the godoc limitations, along with rationale suggesting many frustrating portions were by-design and unlikely to ever change, finally became the overall #2 reason we stopped pursuing Go for internal development (we were previously working on a Go target for ANTLR 4).
--
Sam Harwell
Owner, Lead Developer
Documentation can either be plain text, or can have an officially defined way to reference elements in code. Plain text reads like sentences, which according to the documentation at golang.org is a good thing. Unfortunately, the current design makes all of the following difficult to impossible:
1. Parameter hints in an IDE
2. Automatic rename refactoring algorithms which update the corresponding documentation without worrying about arbitrarily replacing unrelated text that happens to use the same word
3. Fully cross-linked documentation
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Why not use something like TomDoc? It's easy to read and parsable: http://tomdoc.org
On Thursday, June 20, 2013 8:43:35 AM UTC-7, Jeremy McAnally wrote:The testing package's example stuff is great, but it's not inline with documentation. The whole point of this thread is figuring out a way to document things in a readable fashion without a ton a syntax and extra stuff right? I don't want to hunt around in 2 other files to figure out how to use a function.
The examples are displayed inline with the documentation. See http://golang.org/pkg/bytes/#Buffer for an example.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The primary limitations of godoc that I’ve encountered center around the lack of any framework to support links from words in the documentation to actual code elements, necessary both for automatically cross-linked documentation and accurate, reliable IDE-based refactoring tools.
TomDoc suffers from two problems:
1. TomDoc is written with a different language in mind (Ruby), and was designed to address specific concerns, limitations, and documentation requirements of that language. To be absolutely fair (especially since you said “like TomDoc”), support for some of these items could simply be omitted from an implementation targeting Go.
2.
More importantly, TomDoc does not address the concerns I mentioned above. For example, in the example for Class/Module Documentation you see the following
text:
# Public: Various methods useful for performing mathematical operations.
# All methods are module methods and should be called on the Math module.
The Math module reference should me marked in some way such that “Find References” for the Math module identifies this reference consistently and accurately.
Javadoc supports referencing some code elements, but suffers from its own problems.
1. The {@link …} syntax is sufficiently verbose that no one wants to use it.
2. The {@link …} syntax does not allow references to method parameters, so you have to use {@code parameterName} which once again loses the ability to link the reference to the parameter definition.
3. The {@link …} syntax only works within Javadoc comments, which are only allowed in specific locations. Specifically, Javadoc comments are not allowed within a method body, so you can never have a comment within a method body that references a local variable by name, where a Rename refactoring operation on that local variable will silently, consistently, and accurately update references to the variable from comments within the method.
I strongly feel that the semantic rules of documentation should meet several requirements to address the needs of both users and tools.
1. The syntax needs to be simple, easy-to-type, and unobtrusive when reading the raw comment text. As a simple example, most users would agree that Markdown code syntax `text` is better than Javadoc’s {@code text} and C#’s <c>text</c> on all of these measures.
2. The syntax needs to be usable from any comment in the language, not restricted to particular comments in particular locations. This requirement is fundamental for proper IDE support.
While I have not created a complete specification for documentation, the following rules may serve as some interesting food for thought.
1. References to named semantic elements of go code within comments could be written with `backticks`.
2. Which a comment appears within a method body containing an elements in `backticks`, the identifier in `backticks` is resolved as though it appeared at the end of the line following the comment.
3. When a comment appears outside of a method body and immediately precedes a code element Foo and the comment contains an element in `backticks`, the identifier in `backticks` is resolved as though it appeared on the first line of the body of Foo.
4. When a comment appears outside of a method body and does not immediately precede a code element, an identifier in `backticks` is resolved as though it appears on the line following the comment.
If the go language designers and/or community are interested in truly attacking this problem, I would be delighted to provide feedback on the suitability of the final design to meet the needs of automated tools (refactoring and analysis) within an IDE.
If you have an indented line that starts with the name of a parameter, assume that the rest of the line (and any subsequent lines whose indentation matches) documents the parameter.
func Create(name string) (file *File, err error)Create creates the named file mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. If there is an error, it will be of type *PathError.
False positives are not harmless during a refactoring operation. You may not use (or even like) automated refactoring tools, but you should be aware that the convention described below permanently incapacitates any future attempt at creating a true automated refactoring tool for Go code.
--
False positives are not harmless during a refactoring operation. You may not use (or even like) automated refactoring tools, but you should be aware that the convention described below permanently incapacitates any future attempt at creating a true automated refactoring tool for Go code.
buffer - the session input buffer.responseFactory - the HTTP response factory.params - HTTP parameters.