Hacker News new | ask | show | jobs
by arcanemachiner 1028 days ago
How about explicit depth levels, specified by asterisk count?

e.g. '/*' and '*/' would match each other, '/**' and '**/' would match, and so on.

That way, you would have full control of the depth of the comments, removing other comments wouldn't break the inner comments, etc.

I do run into the same issue you're describing, so I think there's value in the idea.

2 comments

The core idea here is that when I'm commenting out a block of code for testing, I don't really want to think about what is inside of it. So while I think this might help, I'd rather just have /* with one asterisk nest.

What I'm not sure of is whether there's an edge case I haven't thought of which would make this problematic.

Like Lua, where comments can be delimited by `--[==[`..`]==]`, where the number of equals signs can be anything but has to match in order for the comment to actually close?