4 ms·
Why ?
by tgflynn 4y ago
Why ?
- rootlocus 4y agoBecause it has a VM (portability, multiple languages interact seamlessly, bytecode manipulation at runtime, low compile times), insanely fast GC, best tools in the industry (IDEs, static code analysis, debugger, libraries), and it's still fast enough to write HFT software with it. It's even possible to compile it ahead of time, making projects like a Clojure CLI scripting runtime with almost instant startup time possible (babashka).
- melony 4y agoSlow startup and build times aside, the JVM is a very robust, production-ready environment. Excellent cross-platform support (if we ignore pretty GUIs) and runtime performance within a factor of 3 of C's. There are plenty of open source libraries and the Java ecosystem is massive. The language is safe and garbage collected by default, but you can achieve performance on par with C when you absolutely need to. You can use it for anything short of driver/kernel development. Even the slow start-up time is being fixed with GraalVM. If they can port over some of C#'s syntax improvements, then the language would be perfect. Compared to .Net for example, the JVM is much more well understood.
- rootlocus 4y agoGraalvm has support for ahead-of-time compilation of JVM languages. They promise "native executables [that] start nearly instantaneously, are smaller, and consume less resources of the same Java application". This is how things like Babashka (Clojure CLI scripting runtime) are possible [0] 0. https://babashka.org/ https://babashka.org/
- metadat 4y agoNative isn't quite there yet, but once it matures and the potential can be realized, it's going to be pretty cool indeed!
- PaulHoule 4y agoClean, orthogonal design. Support for metaprogramming in the form of introspection, reflection, compiling bytecode on the fly. Threads that work. Threads that work cross-platform. No GIL. Efficient memory allocation, garbage collection, JIT compiler. When problems are found with Java they get fixed https://www.cs.tufts.edu/~nr/cs257/archive/bill-pugh/jmm2.pdf https://www.cs.tufts.edu/~nr/cs257/archive/bill-pugh/jmm2.pd... most other programming languages make excuses. Build system with dependency resolution that works (unlike Python) IDEs take advantage of static nature of language. Static nature of language enables refactoring. Lambda syntax that's probably more concise than your favorite language. Implementation of Lambdas that meshes perfectly with existing practices in Java. All-virtual polymorphism is one of many ways that Java doesn't steal IQ points from you the way C#, C++ and languages like that do.
- agumonkey 4y agoWhat about the fact that Java didn't want lambda in the first places, only to hack anonymous inner classes that were never well promoted until 20 years down the road people realize it's quite useful to express logic as functions ? :)
- nextos 4y agoThis was a mistake. Actually, Gosling said he was planning to add lambdas but ran out of time. Some APIs were excessively verbose due to the lack of lambdas, which were emulated using anonymous inner classes.
- agumonkey 4y agoInteresting, not what I recall (but my readings on this were quick). AFAIK it was carefully not pursued because they wanted to make everything as classes so they went with AIC. If you have a link, please share.
- nextos 4y agoThere might be some better (primary) sources: Gosling say closures represent the realization of a dream that was postponed in Java's early days and resulted in the invention of inner classes - "an uncomfortable compromise" that failed to provide the desired level of simplification. He notes criticism that closures are too complex, but advises people to read "through all of what Neal has written". https://www.theregister.com/2008/02/01/java_closures/ https://www.theregister.com/2008/02/01/java_closures/