If Scala is going to get [] for collection literals, why wouldn’t go a step further and make it a new better syntax for tuple literals?
How come it can be better?
- Tuples are collections already, so collections would be covered automatically.
- It would also solve the long-overdue issue with the current tuple literal syntax – it would allow to declare empty and 1-item tuples consistently without clumsy workarounds (like
(,)and(a,)):[]– empty tuple;[a]– 1-item tuple;[a,b]– 2-items tuple and so forth.
- Perhaps(!), it might also be possible to go even further, and unify tuple literals and tuple type definitions:
which in turn would solve the other issue raised in this topic:type T0 = [] type T1 = [Int] type T2 = [Int, String]
So it seems that [] for tuples could bring far more improvements than just a convenience syntax for collections (which to me does not seem really important).