Hacker News new | ask | show | jobs
by BoyRobot777 2606 days ago
Here we go again with "true Generics". Type erasure makes interop easy (for an almost insignificant cost), including with Java prior to generics. But that's also what makes different languages on the Java platform interop so well (contrast with the CLR, where this is not the case; they've baked variance into the runtime and are paying a high price for that decision). If Java had baked their type system into JVM, Scala, Kotlin, Groovy would have to dance around that. Haskell, for example, erases all types, not just type parameters (well, sort of; it does reify the constructor tag/discriminator, which corresponds to type information in Java), and people get fancy with types in Scala, too. The only real annoyance erasure brings is that you cannot overload a method with another that erases to the same type.

All in all, The JVM is leading not only CLR on all fronts, but pretty much any other runtime. C# compilers and GCs are at least a decade behind Java's. You may argue on how important those things are compared to other tradeoffs, but those are the areas where Java was designed to compete at, and those are the areas where it is leading by a wide margin.

Edit: when Java was first introduced, its original designers stated their intention to construct a conservative, low-innovation frontend language, and a high-innovation runtime. In many respects, .NET has the opposite design. You may prefer one or the other and that's OK, but it makes comparing the two on any single aspect very problematic. Of course Java won't keep up on language innovation compared to .NET, and of course .NET won't keep up with Java on runtime innovation -- they each choose to get their competitive advantage in different aspects.

1 comments

Seeing that generics have been around since 2005 in C#, I think the .Net community has had plenty of time to work around the incompatibilities....

There are other languages that support CLR besides C# and they manage to “work around” generics.

All in all, The JVM is leading not only CLR on all fronts, but pretty much any other runtime. C# compilers and GCs are at least a decade behind Java's. You may argue on how important those things are compared to other tradeoffs, but those are the areas where Java was designed to compete at, and those are the areas where it is leading by a wide margin.

By what measurement? Have any specifics?

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

https://www.degruyter.com/downloadpdf/j/acss.2018.23.issue-1...

And Java still doesn’t have anything equivalent to LINQ.

F# does not have higher kinded types, because of CLR. So no, they don't manage "work around" generics.

Regarding measurements: https://www.techempower.com/benchmarks/

Also, I am very interested to see new benchmark results once AOT SubstrateVM will be more widely adopted in JVM community. Demo: https://youtu.be/MN6jNIwl2FQ?t=1136

RedHat already working on a framework which takes full benefit of that: https://quarkus.io/

All in all, with upcoming value types, SubstrateVM adoption, fibers and nice languages improvements like records, future is brighter than ever for Java.

Edit. Regarding JVM vs CLR https://news.ycombinator.com/item?id=15955685

And the only person who is saying that is so (with a lot of people disagreeing) is someone who “work[s] at Oracle on VM research”
Well, I agree, and I don't work at Oracle. So? Any other conspiracy theories?
Care to post benchmarks?
Benchmarks of what?

What exactly in BoyRobot777's comment (which I said I agree to) calls for benchmarks to be proved?

Nowhere are benchmark results taken for granted as faster or anything. Grandparent says: "Also, I am very interested to see new benchmark results once AOT SubstrateVM will be more widely adopted in JVM community."

I simply agree with the statement made: "All in all, with upcoming value types, SubstrateVM adoption, fibers and nice languages improvements like records, future is brighter than ever for Java." -- so, I responded to your comment which seemed to be skeptic of that (and accusing the parent of working for Oracle).

If you were referring to someone else and some other comment, why post your comment as a response directly under BoyRobot777?

> Also, I am very interested to see new benchmark results once AOT SubstrateVM …

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

In some cases, the faster program with OpenJDK does not seem to be the faster program with Substrate VM.

In other cases, the faster program with OpenJDK seems to fail with Substrate VM - maybe it needs something different on the command line?

Otherwise, the same program is shown for both.