-
Notifications
You must be signed in to change notification settings - Fork 1
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
Multiline comment issue #7
Comments
Additionally, as it stands right now, it looks kinda bad to have an inline-multiline comment (if that's even valid)
|
Brick's multiline comments are actually known as documentation comments, as they don't only comment out code, but augment the code further. When I was designing the comment syntax I wanted something easy to deal with, and people seem generally happy with Python and Ruby's single-line comments. So I augmented the single-line comment syntax to create sane documentation without directional indicators, because you should never be nesting documentation. After realizing the ambiguity in cases like the one in this issue, the 'standard' doc strings were made a bit more verbose. This is the proper style for a doc comment.
This is still valid, but not good style:
It should be
There are no inline-multiline comments. I mean, in theory, yes you can do that. But no. Don't do that. |
...So no OCaml style comments within comments? |
Also, there arises the problem of if I have a class such as
I have no way to comment out the entire Bar class without putting #'s on every line, and if I try
I'm not even sure if what will happen will be what I wanted. |
This is actually a big problem if i want to put commented code into a comment. |
No, there are no nesting comments. And there's nothing wrong with this, most languages don't have it. OCaml is the exception. You should be doing this: module Foo
# #=
# # This is the Bar class
# #=
# class Bar
# members
# name : String
# id : Int
# #=
# # This is the Foo method
# #=
# method Foo
# self.name + ": " + self.id |
So, the following nice, big, descriptive comment block is invalid:
But I would really like to be able to have a nice big comment block like that. |
Oh lordy, I can't put github flavored markdown tags in my github flavored markdown. This is an issue. Edit: corrected by introducing an error in the closing tag for the markdown block inside the code block |
In short, neither github flavored markdown nor brick's current multiline comment syntax allow me to validly have 'code in my code,' yo. |
We're actually going to offload markdown lexing and parsing to a separate module. So that should be valid. The standard brick lexer never touches the inside of markdown code blocks exactly for that reason. |
It's actually going to be something similar to YARD or Doxygen, but for Brick, probably as a pallet. |
@toroidal-code Did you intentionally leave out the |
@thenickperson it does look a little funny, and I'm open to suggestions. The reason it's like that right now, is because it makes it easier for the compiler to handle, since the lexer can ignore everything after a '#' but still see the tagged info. Unlike YARD which is an extension to Ruby, the document builder and parser will be built in to kiln. The parser would only see this:
|
@weswigham still wants to be able to have multi-line comments inside his multi-line comments.
|
@weswigham as mentioned in comment 29488529, since the lexer skips things between Markdown code block fences, that is totally valid. |
But can it handle markdown code fences inside markdown code fences? Because it needs to do that, too. |
That'll be part of the markdown parser, which will be a separate lexer and parser inside of kiln for documenation rendering. (We'll probably end up using parts of redcarpet or markup). We can address that when we build those components. |
I really like the way multiline comment look right now,
Here's the problem, though:
What in that is actually commented? In other languages, it would depend on the direction of the multiline comment sigil, eg.
The remedy is trivial, change the multiline comment syntax to having an 'opening' and 'closing' sigil.
Perhaps
Which, for style, means you could
If you were into that kinda thing.
The text was updated successfully, but these errors were encountered: