logoalt Hacker News

TedDoesntTalkyesterday at 6:37 PM1 replyview on HN

Java has a lesson of what can go wrong with types, just as parent says. That example is dates and times. So many types…

And before Java finally settled on what we have today, we had 3rd-party libraries like jodatime that tried to fix it.

I guess it’s in a good state today, but it took a LocalDateTime.MAX to get there. I mean an Instant.MAX. No, I mean an OffsetDateTime.MAX. No, I mean new Date(Long.MAX_VALUE). Oh wait I meant new Timestamp(Long.MAX_VALUE). No, I mean LocalTime.MAX.

I’ll stop now, but i could go on.


Replies

ameliaquiningyesterday at 11:38 PM

How would dynamic typing have helped with this? Presumably all those different classes would still exist and create fragmentation and compatibility problems; they'd just surface at runtime instead of compile time.