For a couple weeks, I've been investigating the potential to build a unified (and arity-unlimited) array-backed Tuple class using macros
and the Dynamic trait, based on my original idea and the discussion that followed onanother scala-lang thread.
I've now written a starting-point implementation, which I've published
on Github. I've implemented most of the important
part of the core Tuple interface, including Tuple creation, member access, stringification, and structural equality (and
the tests to show that they likely work right). There are still some significant features missing, however; I still need to
implement the 'copy' method and a way to convert to native Tuple types, for instance. I also plan to implement a mutable
version, which would pretty much be HArrays improved runtime performance.
In any case, my next goal is to put the code through a thorough round of microbenchmarking. To this end, I am soliciting
suggestions as to what sorts of benchmarks people would like to see and any obviously-poor implementation choices
that I've made (if you can read my code. If not, say so and I'll go into more detail).
Notes on expected (by me) performance: Performance is likely to be strongly affected by what types are present in the
tuple. Specifically, a Tuple where all members are of the same (primitive) type will likely be significantly faster than one
that contains a primitive and any reference type or 2+ primitive types. Reference-type members, however, should always
be fast to access (with the dubious case of a tuple containing a single reference being the fastest of all). It's actually a bit
more intricate than this and if someone wants to talk about the corner cases that I had to handle to make these things
behave properly with covariant type parameters, just let me know, and, once again, I would be happy to go into actual
detail on the implementation.