vavr-io / vavr

vʌvr (formerly called Javaslang) is a non-commercial, non-profit object-functional library that runs with Java 8+. It aims to reduce the lines of code and increase code quality.
https://vavr.io
Other
5.75k stars 637 forks source link

Sealed Class Support #2686

Open GeluOltean opened 3 years ago

GeluOltean commented 3 years ago

Hey everyone!

Considering JDK17 is a LTS version and the sealed class feature being production ready with its release, are there any plans regarding using this feature for defining parametric algebraic data types? Being able to use switch expressions to pattern match would be great for developer experience.

Not sure if using JDK17 would be out of scope for now or not, hence the issue.

danieldietrich commented 3 years ago

Hi! Thank you for asking - yes, indeed, I plan to migrate to JDK17.

GeluOltean commented 3 years ago

I'd love to help out with this!

danieldietrich commented 3 years ago

Thank you! Please outline your idea here first, e.g.

GeluOltean commented 3 years ago

Will do! Taking a closer look now, was waiting to clarify whether JDK17 is desired/planned.

Indeed, I was thinking about changes for Either, Option, Try and Validation. Will come back soon with a more detailed outline in a bit.

danieldietrich commented 3 years ago

Great to hear! Thank you!

bduisenov commented 2 years ago

Hey @GeluOltean, do you have any updates on this?

GeluOltean commented 2 years ago

Hey @bduisenov; got a bit overwhelmed by a previous project and did not manage to make much progress on this. It should be possible, but I do not have an idea yet of how extensive the changes would be.

eslep commented 2 years ago

@bduisenov @danieldietrich I'd be happy to take a crack at this, as I'm quite happy about Java introducing Pattern Matching and am eager for this.

The plan would be quite simple I think.

Candidates:

Approach:

\ The only real issue I see here (from my understanding) is the fact that #2346 will be blocking this due to the Java version update.