5 ms·
AttributeError: 'NoneType' object has no attribute isn't much better. Java might not be perfect, but it does let you catch a lot of problems at compile time r
by throwavay_java 11y ago
AttributeError: 'NoneType' object has no attribute
isn't much better.
Java might not be perfect, but it does let you catch a lot of problems at compile time rather than run time, which is a step in the right direction. The alternative (run it and see) gets old fast.
- pka 11y agoWhile I agree - this particular alternative is worse - it's not the only alternative. I was talking about more expressive type systems, not less.
- dragonwriter 11y agoJava provides less of the benefits of static typing than many other statically-typed languages (even than others available on the JVM), at a much higher cost in required ritual invocations made to the type system. Yes, there is a value in static typing, but that value is minimized when you have a type system that isn't particularly expressive and/or have to make add a lot of redundant code to satisfy a comparatively unsophisticated type checker. Java may have gotten slightly better since its poor performance in cost:benefit terms when it came to static typing helped launch the surge in popularity of dynamic languages, but its still not a great poster child for the benefits of static typing.
- codingbinary 11y agoAnd don't forget Java's type erasure. Still wondering how they could actually call that a FEATURE.
- potatosareok2 11y agoWas erasure necessary to maintain backwards compatibility? Also what are you doing that you need type information at runtime?
- dmm 11y agoNo it wasn't necessary to maintain backwards compatibility. Type erasure was implemented to allow libraries to upgrade to generics without breaking compatibility with existing applications.
- wtetzner 11y agoHow is that not backwards compatibility?
- codingbinary 11y agoThe one is on a language level, the other on an application/framework level.
- codingbinary 11y agoType Erasure is the reason you can't use builtin types as generic arguments. And in a lot of cases it forces you to cast. And as type erasure happens very, very early in the compilation process, you lose a lot of static type information the compiler could act on or give you warnings.
- dozzie 11y ago> Java provides less of the benefits of static typing than many other statically-typed languages Don't let Java's type declarations fool you into thinking that Java is statically typed. It's still dynamic typing, with merely some kind of type hints slapped on top to be checked at compile time.