I've written a lesson about some of the more advanced capabilities of enumerations in Scala 3. It's still "beginner level", so I managed to avoid going into detail on variance, but virtually everything else is covered: https://scala.zone/courses/scala-beginner/data/enums2 …
-
-
Replying to @propensive
I drifted away from Scala (job wise), but are there no more sealed traits, just enums? The enums with fields seems dangerous
2 replies 0 retweets 0 likes -
Replying to @oferron @propensive
Sealed traits are still there. The new enums add more flexibility, as well as concision, compared to the the old enumerations, so they can be used for many abstract data types now.
1 reply 0 retweets 1 like -
Replying to @deanwampler @oferron
The new enumeration syntax should cover the vast majority of ADT definitions that would previously have been implemented with case classes and sealed traits, but they're still implemented that way under the hood.
1 reply 0 retweets 2 likes -
The type inference in pattern matching GADTs or GADT-like structures is a big change. It was broken now it’s magical.
1 reply 0 retweets 1 like -
That was also out-of-scope for the lesson, but Guillaume Martres talks about it here: https://gist.github.com/smarter/2e1c564c83bae58c65b4f3f041bfb15f … Maybe one of the later, advanced pattern-matching lessons will cover this... as soon as I've understood it myself.
1 reply 0 retweets 0 likes -
Good one. I saw Alex, who did the work on this, describe it in a Scala symposium talk in London last year. Some ripper examples.
1 reply 0 retweets 0 likes -
Which Alex was it?
1 reply 0 retweets 0 likes -
That would have been Aleksander Boruch-Gruszecki. https://2019.ecoop.org/details/scala-2019-papers/4/Towards-Improved-GADT-Reasoning-in-Scala …
1 reply 0 retweets 1 like
Thanks!
-
-
My favourite Scala 3 feature because programming is all about typed embedded DSLs you know.
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.