-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Nested block comments #10730
Comments
Hi, my name is Francisco and I'm a computer science student that is fascinated by the wonders of Nix. With that being said, I would like to start contributing to the project and think that this could be a good first issue for me to tackle. I've already delved into the codebase an think that the problem might be in the lexical analysis (the Flex file at |
As a reference jsdoc has the same problem. Here is the 10 year old issue: Many languages seem to just not support nested block comments. still would be nice if nix did. Workarounds:
|
@FranciscoTGouveia great to have you! I assigned the issue to you as requested, please add or ping me as a reviewer for PRs. Note that since we're very conservative with evolving the language, we'll have to make sure that the change is strictly additive and doesn't break existing expressions. We may therefore want to add a test that evaluates past Nixpkgs releases. |
Concretely, an expression like this may cease to be valid:
This instance could be mitigated by requiring whitespace to precede the nested comment. We can't know the true extent of such issues, because of private code bases. A simpler solution to the doc comments use case is to recommend that the commented text be unescaped by documentation tooling, according to some rules to be specified. For example, EDIT: escaped the wrong end |
Another idea:
Then this would work
But this would break:
|
Apparently I'm ignorant and full of wishful thinking about how computer languages work, but apparently saying a naive thing such as "the longest sequence of characters between |
I don't know where you got that, but the longest sequence would also ignore |
@roberth agreed, recommending unescaping is the least invasive and simplest thing to do here. |
Nested block comments apparently aren't a thing in the Nix language. How sad.
Steps to reproduce
Trivia
I'm actually surprised how no one seems to have stumbled over this.
Thanks to @hsjobeki's RFC 145 there is even a use case for nested block comments: documenting how to document Nix language libraries within a Nix language library!
The text was updated successfully, but these errors were encountered: