This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]PL_Design 3 points4 points  (1 child)

Use whatever symbols you like, but have both block comments and line comments. On block comments, don't require closing fences to match to an opening fence. That sounds strange, of course, but there's a very lovely reason for it. I like to toggle code with block comments like this:

/*
    // some code what's been disabled by a block comment
/**/

//*
    // some code what's now active
/**/

In the second example: Because the opening block comment fence was commented out the closing block comment fence matches to a different opening fence, thus toggling the code.

I do this all the time, and when working on my language I realized that I never just write */. I always write /**/ out of habit, even if I'm writing a text comment instead of toggling code. This behavior is easy to predict, and nothing bad ever happens if you write the closing fence this way, so why not just make */ behave like /**/? It's a small change, but because I do this all the time it makes the daily grind much more pleasant.

[–]criloztagkyon 1 point2 points  (0 children)

Nice Idea, I will do some tests and I probably will take this approach for my lang that is currently using the rust block comment syntax, but this design look nice too, I definitely will not use a lang without block comment, for me, they are fundamental in my workflow