Le 25/09/2012 01:39, Andrei Alexandrescu a écrit :
On 9/24/12 6:28 PM, bearophile wrote:
Timon Gehr:
My bikeshed is colored one of these:
(:1,2)
(|1,2)
At that point you might as well just use
import std.typecons : q = tuple, Q = Tuple;
Q!(int, int) foo(){
return q(1, 2);
}
If built-in tuples are not going to look like
(1, 2)
then imho we might as well leave them out,
But the banana syntax doesn't look bad:
(||)
(|1|)
(|1, 2|)
(|1, 2, 3|)
tuple()
tuple(1)
tuple(1, 2)
tuple(1, 2, 3)
also arguably enjoys the same advantages and in fact is much more
intuitive. Like, totally intuitive. Like, it says "tuple" to create a
tuple. And one advantage is, there's never ever going to be butt jokes
about tuple() as there'd be with "(||)".
The problem with tuple() isn't its syntax, but what you can or can't do
with the resulting tuple.