i feel like such an anomaly being a functional dev who actually likes java
Conversation
Notices
-
Embed this notice
Arch 💕 (archenoth@chitter.xyz)'s status on Tuesday, 28-Nov-2023 05:08:26 JST Arch 💕 -
Embed this notice
tech? no! man, see... (technomancy@icosahedron.website)'s status on Tuesday, 28-Nov-2023 05:08:20 JST tech? no! man, see... @archenoth doesn't the null problem just depend on the libraries you use tho?
like ... the good thing about the Option monad is that it allows you to create a language that doesn't have null; you can guarantee it's never going to exist
whereas if you have null *and* Option, now you never really know what you're going to get, unless you're just super disciplined about your own coding and never call any code written by someone less-disciplined than you are?
-
Embed this notice
Arch 💕 (archenoth@chitter.xyz)'s status on Tuesday, 28-Nov-2023 05:08:22 JST Arch 💕 then again, we are talking about a language that now has destructuring pattern matching, and quite a few mostly-monads that let you chain together lambdas and method references while still giving you type guarantees
all while never needing to touch null
plus, as a neat bonus, you can interop with it using clojure! my favorite language (or even outright embed it!)
-
Embed this notice
tech? no! man, see... (technomancy@icosahedron.website)'s status on Tuesday, 28-Nov-2023 06:15:23 JST tech? no! man, see... @archenoth gotcha; so you just have to be diligent about protecting your boundaries then; just assume that any library that doesn't mention Options needs to be wrapped up
seems like it would still be quite difficult if you had a pre-existing mid-to-large codebase and you were trying to modernize it gradually, but for greenfield it shouldn't be as much of an issue
-
Embed this notice
Arch 💕 (archenoth@chitter.xyz)'s status on Tuesday, 28-Nov-2023 06:15:24 JST Arch 💕 @technomancy partially! `Optional.ofNullable()` is an okay thing to shove returns from external libraries into, since you can then treat them the way you usually would, you can also use `.map()` instead of `.flatMap()` to call nullable methods in ways that, if they return null, still are inside Optional
...or you can do what i did and make a Result sealed interface that you can just say Result.of(anything), and then use it in pattern matching like Rust (or chain it into an Optional)
-
Embed this notice
tech? no! man, see... (technomancy@icosahedron.website)'s status on Tuesday, 28-Nov-2023 06:55:06 JST tech? no! man, see... @archenoth it kinda sounds like Java has been doing a lot of catch-up, yeah, which is great if you're using Java
but it doesn't seem surprising to me that "we caught up to most of what everyone else has been doing" isn't enough to get new people to use it who aren't already using it; there's nothing compelling there you can't get elsewhere
-
Embed this notice
Arch 💕 (archenoth@chitter.xyz)'s status on Tuesday, 28-Nov-2023 06:55:07 JST Arch 💕 @technomancy it's funny that you mention this, because modernizing a mid-sized (~1000 class) codebase is actually exactly what i've been up to~
one thing it really does make abundantly clear is why people don't like java (or rather, the java that everyone who doesn't like it recognizes)
- the dilligent finally usage needed (instead of autoclosing try-with-resources blocks)
- relying heavily on class hierarchies (instead of modern mixins)
- limited generics and Object to get past it
- no lambdas
- no method references
- no Optional
- no switch expressions (just switch-case statements)
- no pattern matching
- zero destructuring
- egregeous boilerplate for classes that only need to hold a couple related immutable values (as opposed to records)
- only platform threads (as opposed to being able to spawn millions of structured green ones no problem)the before and after in some of these cases is absolutely drastic, but also super-satisfying
but, java is blub, so its new stuff get ignored
-
Embed this notice
tech? no! man, see... (technomancy@icosahedron.website)'s status on Tuesday, 28-Nov-2023 07:15:00 JST tech? no! man, see... @archenoth it would be a really compelling list of features! if it were 2015 =)
but nowadays Java spent so long adding ML features that OCaml caught up and actually does multicore now, haha
-
Embed this notice
Arch 💕 (archenoth@chitter.xyz)'s status on Tuesday, 28-Nov-2023 07:15:01 JST Arch 💕 @technomancy oh yeah! this is definitely true
it definitely has an edge against the things people compare it to the most--but there are very few ways it's actually breaking any new ground
-
Embed this notice