I love how Scala does case match with case classes. You can essentially unpack the attributes of a case class and match on them and put additional guards. Example:
bob match {
case Person("bob", _) => println("hi bob!")
case _ => println("I don't know you")
}I think its important that match returns something so you can use outside of a function which this doesn't do.
val greeting = bob match { ... }
I thought it would be a fun exercise to write case classes in python, kind of like an improved immutable data class with a match that returns.
https://mleverything.substack.com/p/scalas-case-class-in-pyt...