4 ms·
> in the JVM classes are an obligation In Java, not the JVM. Some JVM languages like Kotlin and Clojure allow for classless functions. You could argue that it
by Asraelite 4y ago
> in the JVM classes are an obligation
In Java, not the JVM. Some JVM languages like Kotlin and Clojure allow for classless functions.
You could argue that it still gets compiled to bytecode with classes, but then that bytecode gets JIT'd to not have classes again anyway so it's kind of a meaningless distinction.
- kaba0 4y agoWell, the JVM is very vocal about having classes as a basic abstraction. Sure, everything is just bits at the end, but the additional abstraction here is Kotlin and Clojure hiding the classes, in my opinion. But sure, it’s not a fruitful topic to argue on :D
- pvg 4y ago'class' is a first class concept in the JVM. You can't really argue that it isn't by saying it's not in the layer below the JVM or the the fact a layer above it can hide it from you. You can't have a JVM without classes.
- Asraelite 4y agoI mean, the original post was about programming languages, but The JVM is a virtual machine. It does not have "classes" in the programming sense because it takes bytecode, not source code. A bytecode class isn't the same as a source code class. It would be like saying that x86 has if statements because it has branch instructions. I interpreted the comment to mean "JVM languages" but if you wanna discuss the JVM itself (which is nonsensical comparison here imo) then yeah sure, it needs "classes".
- pvg 4y agoYou don't have to get all talmudic about it, you can just open the JVM spec to almost any page. https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokevirtual https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.ht... The semantics of Java classes 'in the programming sense' are largely specified and implemented in the JVM.