Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Jemalloc 5.4.0(github.com/jemalloc ↗)
    37comments
  2. The scourge of x86 emulation(fex-emu.com ↗)
    22comments
  3. Astra for Law(openai.com ↗)
    528comments
  4. Bonsai 2 27B: Near-Lossless Compression in a 9x Smaller Footprint(prismml.com ↗)
    127comments
  5. Bend – A language that blocks AI mistakes via proof, on CPU and GPU(bend-lang.com ↗)
    217comments
  6. Qwen 3.8 Omni Flash(qwen.ai ↗)
    78comments
  7. When the fractional part of a float fixes your shader(crocidb.com ↗)
    1comments
  8. Hister: A private search engine for the pages you visit and the files you keep(github.com/asciimoo ↗)
    165comments
  9. Pre-Greek: The lost language hidden within Ancient Greek(linguisticdiscovery.com ↗)
    33comments
  10. Wax motor(wikipedia.org ↗)
    70comments
  11. Fujitsu launches made-in-Japan next-generation CPU FUJITSU-MONAKA(global.fujitsu ↗)
    229comments
  12. A heap overflow and SSO misconfiguration to compromise OpenAI internal repos(hacktron.ai ↗)
    147comments
  13. Replacing Pull Requests with Delta(zed.dev ↗)
    1comments
  14. Shapelearn Qwen 3.8 27B (13.1 GB VRAM)(byteshape.com ↗)
    8comments
  15. How to Write with an LLM(sockpuppet.org ↗)
    92comments
  16. Speeding up gearhash on ARM64(sam.dev ↗)
    discuss
  17. Why Does the Universe Expand?(cosmicave.org ↗)
    51comments
  18. Ask A Monk – A digital wilderness for thoughts with no immediate answer(askamonk.online ↗)
    23comments
  19. Flet 1.0 – Build cross-platform apps in Python(flet.dev ↗)
    56comments
  20. Telstra outage: The night a network decided the year was 2006(netnod.se ↗)
    23comments
  21. Diplodocus, Long Thought Exclusively American, Turns Up in Spain(sci.news ↗)
    37comments
  22. Why I didn’t sign the Fields medallists’ letter(gowers.wordpress.com ↗)
    368comments
  23. How do we prevent mathemathics from devolving into the Medieval Era of secrecy?(mathoverflow.net ↗)
    105comments
  24. Apple detectives solved mystery of ancient tree and rewrote the history of fruit(scientificamerican.com ↗)
    10comments
  25. CrowdSec Source Code Leak(crowdsec.net ↗)
    48comments
  26. Fixing an NZXT Signal 4K30 part 2: the green/pink video bug(downtowndougbrown.com ↗)
    10comments
  27. The most important product decision is what you don't build(liamnugent.me ↗)
    37comments
  28. Show HN: Snapdrop: Instantly share files between devices. No setup, no signup(snapdrop.me ↗)
    35comments
  29. Infinite-Parameter LLMs: Generating and Adapting Weights from Live Data(arxiv.org ↗)
    39comments
  30. How Uber Protects Against Retry Storms(uber.com ↗)
    42comments

Java's Original Sin

40 pointsby 17y agogbracha.blogspot.com
13 comments
17y agoHN ↗

Great blog post. Especially for those interested in scala and the future of Java.

The comments below, in my view, are just as interesting as the post.

17y agoHN ↗

You can do most of this stuff at compile time and not mess with the JVM. Just add auto boxing to the next version of Java and nothing need change.

As to the 16 byte char just do what most languages do when they get a basic feature down and add a Byte32 or whatever.

PS: I tend to think of Java as a slightly more friendly version of C rather than a high level language. It's fairly easy in Java to open a socket and decode a bit stream, where most high level lanugaes make that far more difficult.

17y agoHN ↗

I think the real original sin was the decision to be a dumbed-down C++, avoiding all the ugliness and hard to get right parts, in particular eliminating operator overloading. With operator overloading supporting the normal meanings of the operators (== means equals, not identical to). Integer would then work the same as int and auto-unblocking would have been there from the beginning. Remember Java overloads '+' for strings, so it isnt consistent.

Primitives made sense at the time, but with operator overloading we wouldnt be stuck with the mess we have now.

And methods should have been first-class objects. More messes that could have been avoided.

17y agoHN ↗

Except the most common criticism of C++ is for being "too complex" or "too clever", so it seems there's nothing inherently wrong in trying to be a "dumbed-down C++, avoiding all the ugliness". You're just saying it made the wrong trade-offs in places.

17y agoHN ↗

Not just methods -- classes should have been first-class objects!

Unfortunately, vocational Java programmers are terrified of anything that resembles metacircularity. There's a depressing tendency to just label anything mildly functional as 'closures'.

17y agoHN ↗

You've noticed that too? I spent six months confused, wondering why most of the so-called closures in Java examples were merely first-class functions.

17y agoHN ↗

"Primitives made sense at the time"

I assume you mean primitive data types not being first-class objects? When Java was born, Smalltalk had a very long history of Ints and Chars being first class objects. The VM/byte-code compiler took care of in-lining values to make their time/space behavior as if they were primitive data types.

17y agoHN ↗

Also, Java was originally targeted at very low end machines - think WebTV. IMO, the top things wrong with Java are:

Too many concepts that overlap - containers, arrays, generics, iterators, classes, interfaces, etc. An important factor in whether you want to use a language is "how many concepts am I going to have to understand to read other peoples code ?"

A lot of the library is very poorly designed, probably because they rushed it out the door. Take a look at the GUI inheritance hierarchy for instance. Also, a lot of the code looks like C code IIRC.

17y agoHN ↗

I don't think checked exceptions are so important. They might make things a little more verbose and painful, but they don't impose fundamental constraints and backwards compatibility nightmares the way other things do. After all, you can always just choose not to use them - just convert everything to runtime exceptions and your own code will be only impacted at the edges.

17y agoHN ↗

After all, you can always just choose not to use [checked exceptions] - just convert everything to runtime exceptions and your own code will be only impacted at the edges.

Forgive me if I'm being dense -- I haven't done much Java programming lately -- but what do mean by "convert everything to runtime exceptions"? Sure, you can define all your own exception classes as runtime exceptions. But checked exceptions seem unavoidable, as you can't (practically) avoid calling all the Java API methods that throw them.

17y agoHN ↗

Sorry, away for a bit and didn't see your reply.

But checked exceptions seem unavoidable, as you can't (practically) avoid calling all the Java API methods that throw them.

Yes, that's what I mean by "at the edges". You can't avoid hitting the ones built into Java but you can stop them penetrating into your own code with a simple try / catch that wraps them with RuntimeException.