Pre-SIP: A Syntax for Collection Literals

So if we don’t want conversion, we can simply have a suitable, concise extension, and then we could in those cases:

val xs: Seq[Int] = (1).tup   // Seq(1)
val ys: Seq[Int] = ().tup    // Seq()
val zs: Seq[Int] = (1, 2)    // Seq(1, 2)

Pretty OK, in my humble opinion. And safe. And readable.

2 Likes