2 ms·
For reference: * JIT was added in Java 1.1 for Windows, and 1.2 for everyone else. But in the early days it sucked. * Generics, autoboxing, and enums were add
by o11c 2y ago
For reference:
* JIT was added in Java 1.1 for Windows, and 1.2 for everyone else. But in the early days it sucked.
* Generics, autoboxing, and enums were added in Java [1.]5 (2004). Prior to that, APIs had to use `Object` everywhere, explicitly wrap primitives when needed, and use plain ints for constants.
* It's $CURRENTYEAR and Java still doesn't support structs, and it's not clear they actually understand the problem (since e.g. they force everything to be `final`).
- cogman10 2y ago> It's $CURRENTYEAR and Java still doesn't support structs, and it's not clear they actually understand the problem (since e.g. they force everything to be `final`) I think they do. The problem they are solving is removing indirection and flattening the memory representation of data. Making all the fields final opens up the JVM to some really neat optimizations you can't get with mutable fields. By the time you get something with enough fields in it that the immutability limitation becomes problematic, you likely would benefit from just having a regular class. Structs won't always be strictly faster than regular classes.
- fiedzia 2y ago>It's $CURRENTYEAR and Java still doesn't support structs they call it records, added recently. Depending on where you work, you may see them in a decade
- cogman10 2y agorecords aren't the structs OP is referring to. Instead, they are thinking of value classes. (at least, that's effectively what a struct means in C#). You will see `value record Point(int x, int y)` which is different from `record Point(int x, int y)`. The key difference being that `record Point` will create a reference to the x/y data with identity whereas `value record Point` will instead represent that data inline without a reference. I suspect that `value record` will be the way pretty much everyone starts using `record` as there's basically no reason not to.
- pjmlp 2y agoJava doesn't want to do a Python 2, a JAR compiled in 2000 has to still work in a Valhala enabled runtime, assuming it didn't use any of the now deprecated APIs. You can play with early releases, https://jdk.java.net/valhalla/ https://jdk.java.net/valhalla/