You guys should love this! It makes something Java-compatible (a Tuple2<String, Integer>), while being a bazillion times less verbose.
The price for doing this in the JVM with reasonable Java-compatibility is that Tuple2<A,B> is a different class than Tuple3<A,B,C> than Tuple4<A,B,C,D>. Tuple goes to 22.
Collections-like frameworks dealing with Tuples often have to generate versions of methods that operate on one of each version of tuple, which is why you see 22 methods here, one to generate each version.
As much as I think scala is a little kitchen sink already, and macros are yet another feature I don't think people need in scala, they'd be useful to generate this code pattern.
4 comments
[ 4.9 ms ] story [ 16.0 ms ] threadI go check what it is, and find this WTF (line 158 and on):
https://github.com/twitter/util/blob/master/util-core/src/ma...
Pretty sure twitter also used to have the same thing for time conversions as well.
The price for doing this in the JVM with reasonable Java-compatibility is that Tuple2<A,B> is a different class than Tuple3<A,B,C> than Tuple4<A,B,C,D>. Tuple goes to 22.
Collections-like frameworks dealing with Tuples often have to generate versions of methods that operate on one of each version of tuple, which is why you see 22 methods here, one to generate each version.
As much as I think scala is a little kitchen sink already, and macros are yet another feature I don't think people need in scala, they'd be useful to generate this code pattern.
You can't just use a catch-all argument like xs: Future* because you have to parameterize the types of the arguments.