Tuples and Units
Today on Dotty-Watch: I call your attention to this terribly interesting issue discussion over in the Dotty repo.
The quick tl;dr is that an issue came up around the unobvious differences between Unit
and the empty Tuple
, and some of the consequences thereof. This led to a spirited discussion, at the end of which the team apparently landed on a couple of small but lovely enhancement proposals.
Read the issue for more context, but the high point (as of just a few minutes ago) is that they are hoping to be able to support code like this:
val tup: Tuple = 1 *: 2 *: Tuple()
tup match
case head *: tail =>
case Tuple() =>
Mind, this is just proposed at this point — nothing is real until it is successfully implemented, and approved for Scala 3. But I think it’s a clear win, so I’m hoping that it all works out…