4 ms·
FYI. Java has functions now as well, although they are indeed also objects. Records have been introduced as a flavour of structs.
by spockz 3y ago
FYI. 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.