3 ms·
JVM solves a very different problem. It makes some very strong assumptions: everything is an object (no functions!), garbage collection, no easy structs, etc. A
by nine_k 3y ago
JVM solves a very different problem. It makes some very strong assumptions: everything is an object (no functions!), garbage collection, no easy structs, etc. All this prevents easy porting of lots of existing software written in C, C++, Fortran, etc. In exchange you can be oblivious of the underlying OS and even CPU architecture.
Instead, x64 virtualization easily allows to run not just your existing software, but your existing OS, at practically native speed.
- spockz 3y agoFYI. Java has functions now as well, although they are indeed also objects. Records have been introduced as a flavour of structs.
- nine_k 3y agoJava has functions, JVM does not :) Records are indeed a serious change. (Fibers, too.) JVM runs a bunch of languages that are pretty dissimilar to Java, like Clojure or JRuby. It takes certain creativity, but it works pretty well.
- jdmichal 3y agoJava the language has a lambda / function-literal syntax, not first-class functions. (You know this, obviously.) The `struct` bit can refer to a few things: value typing, stack allocation, and explicit memory layout. I think records give you value typing, but not stack allocation or explicit memory layout. They are just syntactic sugar for immutable POJOs.
- javajosh 3y agoIt's not quite true that everything is an object. In fact, Java famously has a primitive/object split.