News for hackers. Stuff that matters.
Re:Guide to Java Virtual Threads by pron on Thursday March 16, 2023 @07:17AM (#35180525)
There's plenty of stuff Java did first (or only) -- an optimising JIT, two new generations of GC (G1, ZGC--a low latency GC with <1ms max pause time), low-overhead deep profiling (Java Flight Recorder) -- but they're all in the runtime. Java's strategy since the beginning has always been to innovate on the platform and be a last-mover on the language, keeping it conservative. .NET seems to follow an opposite strategy.

That's how we've been able to avoid properties and just have algebraic data types, avoid async/await and do virtual threads, avoid string interpolation and just have safe string templates. This also allows us to keep the number of features in the language relatively low -- as we, and most of our users, like it.

Re:Guide to Java Virtual Threads by DeathArrow on Thursday March 16, 2023 @07:38AM (#35180672)
I'm sure Java dis some things first, as I said. It's great that you mention some.

>That's how we've been able to avoid properties and just have algebraic data types By algebraic data types you mean product types or sum types?

Re:Guide to Java Virtual Threads by wathef on Thursday March 16, 2023 @08:47AM (#35181162)
Both of those (sum and products) are ADTs.
Re:Guide to Java Virtual Threads by pron on Thursday March 16, 2023 @09:22AM (#35181584)
Both. Java has records for products, sealed hierarchies for sums, and offers pattern matching over them. See https://www.infoq.com/articles/data-oriented-programming-jav...
Re:Guide to Java Virtual Threads by DeathArrow on Friday March 17, 2023 @05:44AM (#35194998)
>sealed hierarchies for sums

I wouldn't call that a good example of sum types. You can use sealed classes or other mechanism in C# to emulate sum types. I was thinking about something built in the language.

Example:

type IntOrBool = | I of int | B of bool

Re:Guide to Java Virtual Threads by pron on Friday March 17, 2023 @07:03AM (#35195433)
It's built into the language and the VM (the VM enforces the "sealedness", and pattern matching uses it for exhaustiveness checks). It's just that all types in Java are nominal.