-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 comments #69
Comments
The only issue this doesn't address is nesting, but here's an idea that addresses that too. What if the nesting is based on the indentation and number of
Here, you can easily nest the inner multiline comment inside the function because it's indented, while the outer multiline comment that hides the function definition entirely is flush left.
In this case, you have a multiline comment nested inside of another by using a different number of hash marks, allowing you to easily comment out blocks of code that already have multiline comments in them, just by using more hash marks. I'm imagining that you would mostly use Note that unlike |
I dunno, I think this is harder to use because to comment out a region you have to look through to find the largest number of #'s and add 1. My guess is a pair of symmetric symbols is the easiest. |
Why can't we use |
I'm adamantly against |
I don't think we need any fancy features around comments. Comments are especially easy to parse, so it isn't too hard to write external tools to extract documentation. |
Agreed. You can always add new comment styles (although |
Editors are good these days. Multiline comments aren't really necessary. |
I am new to Julia, being made aware of it via Slashdot. It seems to me that closing this issue runs counter to your "Why We Created Julia" manifesto: you want to create a language that pleases everybody. "Editors are good these days" seems pretty cavalier for a fledgling language with this much promise; lack of multiline comments in LaTeX (and \begin{comment} doesn't count) is a source of much frustration for me, and a similar lack in Julia would be a barrier for me. IMO, the use case of quickly removing/re-adding a block of code during development greatly outweighs the potential breakage introduced by haphazard use, and has the added benefit of not repelling users exploring the language. |
We certainly never said that we "want to create a language that pleases everybody"; that's clearly impossible. |
Let me restate it, then: you want to combine the best features of your favorite languages. The speed of C, the dynamism of Ruby, etc...and the lack of multiline comments of Python? I guess I just don't see the compelling reason for excluding them (if it's a lack of developer time/interest, shouldn't the feature request be left open?). |
I'm not totally against this. I think we mostly haven't found a syntax for it we really like. The blog post takes a bit of artistic license...it's not meant to be a scientific paper. We're not literally as dynamic as ruby (or, of course, as fast as C in general, yet), and we also aren't just combining features of other languages. |
I didn't mean to ascribe exact intentions to you in either of my comments, just the general idea that a good workhorse language should have multiline comments (and single-line comments, as C eventually took to heart after 20 years). It seems to me that if nesting is desired, the syntax should be something like |
How about this:
I still really like the original CoffeeScript-derived multiline comment scheme. If one requires both indentation and number of |
|
Every
|
no mult line comment is fine, if very very want it, /* */ is just ok |
Of all the possibilities, I like ### the best. |
@ViralBShah, do you mean non-nested? The other thing with indentation-nesting is that it breaks the ability of an editor to do auto-indenting of code. @StefanKarpinski, why would you need both indentation and number of characters to make parsing easy? Wouldn't number of characters be sufficient? |
|
That seems quite reasonable. |
(for your viewing pleasure) If you choose to use tab character pairs for multiline comments, use tab pairs for nested multiline comments. using treble octothorpe pairs
using octothorpe vertical_bar pairings
using octothorpe exclamation pairings
using octothorpe colon pairings
|
I personally like the indented I dislike |
FYI, the kate editor plugin can now "fold" comments bracketed by #BEGIN...#END (a suggestion from KDE folks). This choice could change, of course, and I like the lowercase. Meant to advertise/ask for input, but I've been too busy, so I guess this is the opportunity. |
I would rather #bgn .. #end (I find matching tag lengths makes visual scanning more pleasant). Notwithstanding, I'd much prefer copying the way Julia demarks multiline comments :-) |
While it'd be neat, other blocks don't match length with |
true enough I would be happy with having multiline comments as part of Julia with any begin ... end does not introduce a new scope -- presumably #begin .. * On Thu, Nov 1, 2012 at 6:28 PM, Waldir [email protected] wrote:
|
I was recently looking at multiline comments for a DSL. One issue I encountered was that when scanning through non-syntax highlighted code it help to have different opening an closing strings. In the end I used the following:
|
Some thoughts: One issue that can arise with
Paradoxically, multiline comments are often useful on a single line like this:
You could also do it with a single line comment:
but the first approach can sometimes be useful. I think the pair
Benefits:
|
This is the worst feature ever. |
Please consider that block commenting might be valuable within code blocks: I know it looks silly but it might be useful. If that is the case then making it a two character set is ideal. The look of the lisp comment |
Just searching on how to to what EconometricsBySimulation mentioned. It is very cumbersome to do some code testing without block comment. |
See #6128. |
I think @simleb suggestion was by far the best of every single one on this thread.
Benefits:
|
The ship has sailed on this issue – that's why it's closed. |
Either I am going crazy or When building a function is there a way to have multiline comments that work the same way as help function and print out the necassary? And if using jupyter how? |
Multiline comments work in jupyter but the syntax highlighting doesn't. |
Exactly |
right then EDIT: the more I think about it, the less necessary this seems. Considering its really just using Markdown. Was just a habit. |
Jupyter would need a patch to the Julia codemirror mode. (I don't think it was a high priority since multiline comments are rarely used interactively. They are mostly for commenting out large blocks in a file.) cc @malmaud |
Correct. I don't think this is something I could get around to for a while though. |
How is nesting line and multi-line comments supposed to work? Currently (0.5.0) the following code is valid:
However, "wrapping" it inside a multi-line comment produces invalid code:
Is this really the intended behavior? |
Probably Multiline comments are our favorite thing to work on in the parser, and a key feature of Julia overall, so I'm sure @JeffBezanson will jump at this chance to further improve them. 😉 |
Oh, I could have filed an issue, but I'm not even sure that the code should be valid in the first place. In particular: Should a line comment be a line comment within a multi-line comment? And should a multi-line comment be a multi-line comment within a line-comment? My personal gut feeling would answer "no" in both cases because otherwise you are likely to run into problems of "overlapping ranges" which is certainly a Bad Thing (correct me if I'm wrong - perhaps there's a way of preventing this). In that case, the second hash in the code would not start a line comment but be just some character with no special meaning whereas the second So, I repeat my question: Is there an "official opinion" on how to treat nested comments of different types? |
this should parse as a comment,
|
Sigh, can we just delete this feature? |
During my 2 ½ years of Julia I have basically never seen a complaint about this. Just forget it exist? |
I would but people keep commenting on this issue. |
Multiline comments are generally useful though. Since the syntax isn't
ingrained yet, it would still be easy to deprecate it for something better.
…On Fri, Mar 10, 2017 at 10:25 AM Stefan Karpinski ***@***.***> wrote:
I would but people keep commenting on this issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#69 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA8SvRthejzfJrysM9UaBlX437A65el7ks5rkWt-gaJpZM4AF2X9>
.
|
I use multiline comments and think they are very useful. |
@StefanKarpinski We require interspersable annotation. Tapestry is code. Our octothorpe has been more octo than thorpe, three of a kind rather than one kind of three.
For commentary and temporary code isolation, the pair-surrounded commentary context ignores any
|
backport findprev, findlast & tests
* Implement exercise: complex-numbers * complex-numbers: Add bonus tasks * complex-numbers: Add to config.json
* use copy instead of copy_codeinfo * fix for 1.0
Flagrantly stolen from CoffeeScript:
The text was updated successfully, but these errors were encountered: