3 ms·
As soon as you start using comments for something other than comments or documentation, you've basically admitted the language is broken and you end up becoming
by bane 12y ago
As soon as you start using comments for something other than comments or documentation, you've basically admitted the language is broken and you end up becoming Java.
- Ygg2 12y agoFunny that you mention it, but Rust also checks all code in comments/documentation for validity, and runs test on your comments and catches if any of them fails to compile/return appropriate result.
- tomjakubowski 12y agoNo it doesn't. Rustdoc examines the "doc" attribute on every item for Markdowk code blocks and checks those. The "doc" attribute can be attached to an item directly, using Rust's general attribute syntax, or using so-called "doc comments" which are visually and lexically distinct from ordinary comments. In the case of single line comments (the preferred style), doc comments have three slashes instead of two; a good IDE or editor mode for Rust will highlight doc comments differently than ordinary ones.
- Ygg2 12y agoRight, but it's nearly identical to having instructions in comments, like Go does. And while the post I was implying seems to think this isn't a valid use case, I think it is.
- oldmanjay 12y agoI don't understand the conclusion. Java is certainly verbose and a fair bit aggressively ugly, but it has consistent syntax and I've never before heard anyone describe it as broken. care to amplify?
- bane 12y agoWell, not exactly comments, but Java's annotation system is an ugly kludge that should be part of the language and not an attempt at reintroducing C-style compiler directives. The abuse they suffer under various frameworks and ORMs is one of the ugliest things I've ever seen in a language. In almost every-case they either serve little to no purpose, or would be better-off just being part of the language syntax. But now you have to learn Java, and the Java-annotation meta-system. At least they aren't written in XML. note I actually don't mind the Java Community's habit of usingLongNames for things, and the actual language is pretty small and nice.