Hacker News new | past | comments | ask | show | jobs | submit login

There are way more differences between Python and Java than just "having explicit types". If that was the only difference, your comment would make more sense.

I would even go so far as to say that Java's type system is the very one that left such a bad taste in people's mouth that many people swore off explicitly typed languages for a decade or two. It really was that bad, especially before the last few years. It added a lot of extra boilerplate for minimal practical benefit. People used Java because it was fast, cross-platform, and less likely to go horribly wrong than unmanaged languages like C and C++. I doubt very many people used it because they just loved typing tons of boilerplate or because they thought the type system was good enough to catch tons of errors.

The type systems in Rust, TypeScript, and other more recent languages are far more expressive (and capable of catching real-world bugs) than what Java offered. If you think Java has a good type system... things have come a long way since then. Java gets updated continually, and some people will surely jump at my comment and claim things are great these days, but, no. Java is not up to par, even today. C# has done a better job of keeping up, in my opinion, but even it still lacks extremely useful features like proper Sum Types.

I don't have much experience with Python's type hinting, so I can't comment as directly there.




And many of us prefer simplicity in languages.

When a language like typescript supports too many obscure features, or multiple ways to do the same thing, the curve becomes too steep to be proficient.


> C# has done a better job of keeping up, in my opinion, but even it still lacks extremely useful features like proper Sum Types

Does type pattern matching comes close? https://dotnetfiddle.net/Oz2Qyd

Yeah, it doesn't prevent passing unexpected type as object to Print func and getting runtime exceptions. And returning "object" type isn't helpful if we want to prevent runtime errors. But then again, it can be written to spit out compile time errors: https://dotnetfiddle.net/XfKVaa


F# is a great example of a strongly typed language where you almost never have to write type’s explicitly. The best of both worlds IMHO.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: