3 ms·
I don't think those things are necessarily mistakes. Maybe JNI was but most languages took the same approach of exposing interpreter APIs instead of providing F
by thu2111 6y ago
I don't think those things are necessarily mistakes. Maybe JNI was but most languages took the same approach of exposing interpreter APIs instead of providing FFIs to C.
AOT compilation of a dynamic language like Java is hard to do without losing performance. You can AOT Java now with the same compiler used also for JITC (Graal) and you lose, I think, about 20% of the peak performance unless you do C++ style profile collection and double compilation. It's not clear that lack of AOT compilation held Java back any - although SubstrateVM/native-image are getting popular at the moment, that's taking place in the context of hype around "serverless functions". If you aren't using those (or writing small CLI apps, or doing other unusual things) the benefit is less clear.
With respect to proper value types, trying to do that in 1.0 would have just killed the projects. Biting off too much. Look at the complexity of Valhalla - only a small part of it comes from backwards compatibility. Most of it is trying to get the benefits of generics over value types via specialisation without the horrible consequences suffered by other languages. It's not about rectifying past errors but rather, doing something new.
- gher-shyu3i 6y ago> dynamic language like Java Java is a static language.
- kaba0 6y agoStatic in itself doesn’t have a strict definition. You are right that for example java is statically (and strongly) typed, but it has many dynamic elements like class (re)loading, reflection.
- gher-shyu3i 6y agogolang (and D I think) have reflection, yet they're AOT languages. The JIT does a tremendous job of yielding strong performance, and in several (or many cases) being dynamic in this sense bears a negligible penalty. These use cases end up with Java being faster than AOT languages for example.
- kaba0 6y agoYou are right that Java can easily surpass go for example in performance, especially in garbage-heavy programs —- but I didn’t read this thread as if it would be the point of it. My only remark was that Java while statically typed can be quite dynamic (and what is actually more meaningful, the JVM itself can often times swallow the performance impact of even really dynamic code constructs)
- pjmlp 6y agoEven C++ does it, this is not related to the type system.