6 ms·
Lots of shiny new toys to play with :) I like playing with new features and pushing to silly limits. Here's some fun things you can do now: Compiletime checked
by benjiweber 6y ago
Lots of shiny new toys to play with :) I like playing with new features and pushing to silly limits. Here's some fun things you can do now:
Compiletime checked state machines with Sealed Classes [preview feature] https://benjiweber.co.uk/blog/2020/10/03/sealed-java-state-machines/ https://benjiweber.co.uk/blog/2020/10/03/sealed-java-state-m...
Autobuilders, Mixins, Conversions & more with Records https://benjiweber.co.uk/blog/2020/09/19/fun-with-java-records/ https://benjiweber.co.uk/blog/2020/09/19/fun-with-java-recor...
Pattern Matching fun https://benjiweber.co.uk/blog/2021/03/14/java-16-pattern-matching-fun/ https://benjiweber.co.uk/blog/2021/03/14/java-16-pattern-mat...
- exdsq 6y agoLove the state machine example :)
- elric 6y agoNice to see that Records are finally out of preview. But note that Sealed Classes are still in Preview mode and are subject to change (or removal) in newer versions.
- krzyk 6y agoRemoval is not likely, nor is major change. Most likely some minor changes.
- bob1029 6y agoIf you enjoy pattern matching in Java, I would recommend checking out the latest & greatest that C# has to offer as a comparison: https://docs.microsoft.com/en-us/dotnet/csharp/pattern-matching https://docs.microsoft.com/en-us/dotnet/csharp/pattern-match... Being able to combine pattern matching with switch expressions has allowed us to construct extraordinarily concise state machines for our UIs.
- victor106 6y agoI used Java a lot and like some aspects. But I think C# is way ahead in some important ways and Java is playing catch-up
- pjmlp 6y agoThey keep playing catch up with each other, in different ways across the eco-system and language features, since they exist.
- cmckn 6y agoNot considering async/await (because I'm not really a fan), they're neck-and-neck in my opinion. I don't think C# has been as careful with its abstractions and the general aesthetic of the language to the degree that Java has; but in many cases you can almost compile a block of Java as C# and vice versa. I think the primary differentiator is what toolchain/ecosystem you prefer, and I'm solidly on the Java side of that line. That being said, I'm currently getting paid to write C#, so if you've got any resources for converts, I'd love them! :)
- LordDragonfang 6y ago>I don't think C# has been as careful with its abstractions and the general aesthetic of the language to the degree that Java has You say "careful", others would say "stubborn". The refusal to add things like operator overloading lead to a much less aesthetically pleasing language to read and write.
- aardvark179 6y agoI can understand the resistance to traditional operator overloading, but something like implementing a Monoid interface which specifies operator methods might work. I think the sort of value types that people are likely to implement with Valhalla will make the case for this much stronger.
- sproketboy 6y agoBrian has already said that a static set of operators for classes extending Number is on the roadmap. That's all that's required. Arbitrary operator overloading is a terrible idea.
- bestouff 6y agoNice, but I still prefer Rust's match syntax. It feels natural and ergonomic.
- deleted 6y ago[deleted]
- ernst_klim 6y agoOr just use Scala and stay on JVM. You can even easily mix Scala and Java classes within the project.