Skip to content

Conversation

@aznashwan
Copy link

1. Normal comment - doc comment interleaving:

On 0.16.0-dev.1301+cbfa87cbe, the following definition produces the following docs:

/// This is a check if normal comments are interleaved with doc comments.
// Normal comment 1.
/// Doc comment 2.
// Normal comment 2.
/// Doc comment 3.
// Normal comment 3.
pub const Test = struct {
    test_field: u32,
};
$ zig build-lib -femit-docs src/root.zig
$ python3 -m http.server -b 127.0.0.1 8000 -d ./docs
Screenshot 2025-11-12 at 04 46 24

2. Error name change:

As a new Zig learner, one of the most unexpected things I encountered was that you could just define a global error set value by just going error.AnyRandomName without having to import anything (e.g. const error = @import("error");) or pre-declare it in any other place (const AnyRandomName = 123;).

IMHO, such an early example in the reference page should not add an extra potential layer of confusion by making it clear that the error name does not need to be pre-imported and can be arbitrarily defined on the spot.

I'm open to a better name suggestion but it should IMHO not be any error name you'd expect to find in the stdlib.

Comment on lines 424 to 426
Doc comments can be interleaved with normal comments. Currently, when producing
the package documentation, normal comments are merged with doc comments.
the package documentation, normal comments which are interleaved with doc
comments are ignored.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take the old comment to mean that ignoring normal comments was always the intended behavior and that the old autodoc implementation was wrong, so "currently" can probably be removed (as it misleadingly implies that the behavior is subject to change). A few lines above it is already mentioned that normal comments are ignored and that only the two types of doc comments are used for package documentation, so the entire paragraph can probably be reduced to just:

Doc comments can be interleaved with normal comments, which are ignored.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the entire paragraph can probably be reduced

Great call, just updated it, thank you for the clarification!

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.

2 participants