https://www.azul.com/downloads/?version=java-8-lts&os=macos&...
819 karma · joined January 8, 2017
https://www.azul.com/downloads/?version=java-8-lts&os=macos&...
> Everyone still downloads and runs an entire JVM
Nope, we (i know anecdote) use jlink in docker containers, mostly to avoid useless dependencies. The problem of GraalVM native image is that it comes with a subpar GC.
> which broke plenty of Java applications
yes, i agree, modules did not worth the trouble.
For the former, the classpath is a colon separated list of jars (a zip containing the classes). At runtime the VM tries to find a class by scanning linearly all the jars, when needed or panic with a NoClassDefFoundError. The modulepath is a colon separated list of directories that contains some jars. At runtime, the VM revolves the dependencies (stored in the module descriptor of each jar) before starting the application.
For the later, when you define a module you have to explicitly export packages and open them to reflection
This idea has a huge drawback. An instance, can have different shapes depending on the order you discover the fields, by example, if you have a point(x,y), the shape is different if you assign @x first or @y first.
So even if a code is not polymorphic for a human, it is polymorphic at runtime.
In practice, doing a static analysis of the code (maybe only the constructors of the hierarchy) is still needed to alleviate this issue.
My point is that when you develop an application, you only need strawman OOP i.e. calling methods.
You don't need class inheritance if you can pass functions as parameters, you don't need encapsulation given all your pieces co-evolve at the same time (if it's not split than part into a library).
Either the ids should be queried without side effect or not queried at all without a user action.
The second idea, using 'toString()' is well know and also works in other OO languages, Java, C#, etc.
My main grip with Java is that everything is by default a library.
But there is hope, recent changes in Java, records and pattern matching move away from that idea.
The whole quote
> Second, Loom's virtual threads can also be forcibly preempted by the scheduler at any safepoint to implement time sharing. Currently, this capability isn't exposed because we're yet to find a use-case for it
I believe it's a reference to [1] but i may be wrong.
[1] https://download.java.net/java/early_access/loom/docs/api/ja...
https://docs.spring.io/spring-native/docs/current/reference/...
JetBrain is specialized in listening devs, code mining and smooth integration. It seems like a good match, at least in my head :)
When you have a language that support keyword arguments (kwargs) like Ruby or Python more recently.
They want people be to used to the fact that cutting internet is something mundane so the next time they do it because of a protest, nobody will care.
By example, with https://godbolt.org/z/9Kv7oo9oK you can see that values goes into registers (and that thank to 'lea' there is not many registers used).
And if you remove the option -O2, values are spilled on stack.
The story is different, if the variable is captured by a closure/lambda, the current stack frame or part of it may be allocated on heap, leading to perf issues.
The reflection API has two issues, a security check each time you call a method and the arguments being transformed to objects. The code is still generated to assembly code but the assembly code is slower because of that overhead.
With that, STW pause time does not depend on the heap size or on the root set size (the stack size). In practice, it means pause < 1ms, at that point the OS becomes the bottleneck, not the GC.
So latency is good but throughput can be reduced by 30%.
GCs before ~2010 have been optimized for throughput more than for latency. Since then, you can choose.
Since 10 years, G1 let you set your maximum pause time and you get a huge warning if it miss that target, ZGC or Shenandoah are from the beginning latency first, throughput second.
And i'm far from being an expert in GCs, but the basics are just wrong.
It's a little bit sad that they did not hire an expert.
If you stick to two rules, you're out of misery
- never store null in a field, a collection, etc
- checks all parameters that are not nullable (most of them) with Objects.requireNonNull
(it's what Kotlin does automatically BTW)Space bar is our chisel, to craft beautiful codes and reassure our mammal brain that being in the zone make us closest to god
List<String> list = cons("a", nil());
switch(list) {
case Cons<String>(var car, var cdr) -> ...
case Nil -> ...
}
Nil is typed List<Void> which is not compatible with List<String>.You may be able to use extractors as the inverse of the static methods cons() and nil() but that adds more boilerplate.
Disjunctive enums like in Rust or Scala 3 is a simpler way to define ADT.
Java misses the syntactic sugar to define ADT in one place like in Standard ML, OCaml or F#.
The closest you get is to declare records inside a sealed interface, but once you add generics in the mix, it starts to get messy.
I was not able to define a classical list with cons and nil in Java.
sealed interface List<T> {
record Cons<T>(T car, List<T> cdr) implements List<T> {}
record Nil() implements List {}
}
The compiler give you warnings, Cons<T> or Nil are not a top level type and you can create several instances of Nil.