Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Give it to Java to look at nearly every other language and come up with a strictly worse implementation of a useful feature.


view as:

What’s worse?

The requirement to have every line marked as essentially a single line comment, adding a lot of visual noise and basically requiring tool support to automate this tedious work.

Rather than visual noise, it makes comments sections immediately recoognizable as such. Think of page-long comments containing code samples. The tool support is trivial, and you can always run a simple regex to fix it up.

Line comments in general have the advantage that they can be trivially nested, and the nesting be immediately recognizable as such. For any new programming language, I would only support line comments, for that reason.


> Rather than visual noise, it makes comments sections immediately recoognizable as such.

As if they weren't recognizable as such before

> The tool support is trivial, and you can always run a simple regex to fix it up.

Why all this when you could avoid it from the start?

> Line comments in general have the advantage that they can be trivially nested, and the nesting be immediately recognizable as such.

Has nothing to do with and is not applicable to comments written in Markdown


FWIW IntelliJ optionally renders JavaDoc in-editor, kinda capturing that literate programming vibe. I quite like it.

Here's best quick (am on mobile) example I found:

https://blog.jetbrains.com/idea/2020/03/intellij-idea-2020-1...


Rust (and per another commenter, c#) both use the same styling.

From having done rust development, you get used to it pretty quickly and it becomes no noisier than the repeated stars in the block comments.

I’d prefer just having the comment block start with `/*#` personally since Java already standardized on block style comments but this is hardly “strictly worse [than all other languages]”


Legal | privacy