Re: Java type-casting -- Q3
On 09/27/2009 03:32 PM, grz01 wrote:
On 27 Sep, 21:11, Joshua Cranmer<Pidgeo...@verizon.invalid> wrote:
On 09/27/2009 03:09 PM, grz01 wrote:
Or even better, define a general type like
java.lang.Tuple<T1, ..., Tn>
That's an easy one to answer: Java does not have variable-argument
generic types.
I know.
Thats why I wrote you would have to code this feature
into the compiler-core, thus extending the current language a bit.
Would it actually break anything -- or cause any real problems?
I dont think so -- or am I wrong?
Specifying how it would work is not simple. The closest analogue is
variable-arity methods, which uses an array as its actual storage. I
know C++0x has support for such a feature, but emulating its approach
without having template specialization is more than a bit annoying.
Such a feature is nice in theory, but the practical aspect is more or
less a deal-breaker. Variable-argument generic types has very little use
outside of tuples, so adding such a complex feature for so little
benefit is probably not worth it.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth