|
|
|
|
|
by kaba0
1704 days ago
|
|
They are not used that much yet, and the whole deal (with destructuring pattern matching) is not yet ready, but it is basically just records as (nominal) product types and sealed classes as sum types. What is already possible with switch expressions is branching based on type, in a much more ML-like style like case Point p -> …
which doesn’t require instanceof checks and castings, but it will soon become Point(x, y), where the x, y will automatically get the values of the corresponding fields. |
|