4 ms·
Nothing but dirty FUD by someone whose Java skills are at best Junior level. Why is this on the front page? > Java does not trap overflows Fair enough but on
by Traubenfuchs 4y ago
Nothing but dirty FUD by someone whose Java skills are at best Junior level.
Why is this on the front page?
> Java does not trap overflows
Fair enough but only relevant for specific problems/domains. Never encountered this in 10 years.
> Java allows data races
It does not, if you use its dead simple std lib concurrency collections. Also it brings all the concurrency primitives you'd ever ask for (mutex, semaphore, synchronized and god knows what) and guaranteed latest-read "volatile" keyword if you really want to go there. Which you shouldn't. Use AtomicReference, AtomicInteger, ConcurrentHashmap, etc. If you struggle with data races in Java, you are at best a Java junior programmer and should study it instead of writing FUD.
> Java lacks null safety
I like null. Matter of personal opinion. If you are an anti null fetishist, go with Optional. If you want to go even further, use validated @NonNull annotations.
> Java lacks named arguments
Personal opinion. Syntactic sugar I never missed. IntelliJ and VS Code offer inlay hints to overcame this if it really helps. May I also offer you some rainbow colored braces for dessert?
- kasperni 4y ago> Nothing but dirty FUD by someone whose Java skills are at best Junior level. Lamire (the author of the blog post) is well know as the author of https://github.com/RoaringBitmap/RoaringBitmap https://github.com/RoaringBitmap/RoaringBitmap which is in widespread use.
- kjeetgill 4y agoI love Lamire's blog posts and think he's brilliant, but I'd have to agree with the GP (though more gently) that this really does read like a list of "Things to Watch out for: My First 6 month of Java". I suspect that weirdness has less to do with Lamire, but the weird expectations that it tries to "debunk". Like no ones out here arguing that Java is some especially safe, super high validation language. Sure it's memory safety was a huge breath of fresh air compared to C/C++, but it's not in the same vein of reputation as an Eiffel or Ada or even Rust.
- anuraaga 4y agoPerhaps the intent was seeing what crazy HN thread would be started :) My reading of the last paragraph was that there is no safe language since in the end it's always up to the programmer.
- kaba0 4y agoWell, I did have to debug a Rust program with valgrind/miri so it is not like safety is a singular axis (not shitting on Rust, I really like the language, but it is a low level language exposing low-level constructs thus low-level bugs can rear their ugly heads)
- eternityforest 4y agoA safe language isn't a language that lets you do things safely, it's a language that will not let you do them unsafely, or will at least make it hard to do so. The moment you allow things that don't work well with the prover, people will use them, and the whole ecosystem becomes unsafe. And by extension, your code becomes unsafe, if the compiler can't reason about what happens when your code calls theirs. Plus, unless you have just the right linter set up, you can still accidentally mess up and do something unsafe if the compiler lets you.
- lenkite 4y agoWhen we call a language “safe”, that formally means that there’s a proof that no well-formed program in the language can do something undefined. Java is completely safe by that definition. Now, you can have the seat-belt even tighter than that for various types of <domain> safe, but we are moving the goal-posts of the definition.
- Akronymus 4y ago>...or will at least make it hard to do so. Also known as the pits of success.
- ImprobableTruth 4y agoNull pointer exceptions by far the most frequent exception I encounter. Not only on the development side, but also as a user. Optional is convention based and @NonNull just throws the runtime exception at a better location, so in my experience neither come remotely close to providing null safety.
- kaba0 4y ago@NonNull and similar annotations can and are used by static analyzer programs to completely eliminate null exceptions. For example Checker Framework can do that and much more. This is the exact same thing that languages with null-safety have “in-built”. Sure, language support is nice, but it is here and is working
- timeon 4y ago>> Java allows data races > It does not, ... If you struggle with data races in Java How can one struggle with data races if it does not allow it.
- BeefWellington 4y agoA lot of "I know better than standard library authors" custom code to do things that already exist elsewhere, basically. I've seen what GP was referring to in practice.