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?
Both of those (sum and products) are ADTs.
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
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.