Tuples and Units

Mark "Justin" Waks
1 min readMay 25, 2020

--

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…

--

--

Mark "Justin" Waks
Mark "Justin" Waks

Written by Mark "Justin" Waks

Lifelong programmer and software architect, specializing in online social tools and (nowadays) Scala. Architect of Querki (“leading the small data revolution”).

No responses yet