There's no reason that Tuple<T> can't inherit from T.Actually, I can think of reasons that it can't. In particular, suppose that T and Tuple<T> both have the same method. I don't know Rust syntax, but suppose you have something like
class MyClass {
int n1() {...}
}
var mc = MyClass()
var t = (mc,)
and that (mc,)
is interpreted as identical to mc
. What does t.n1()
call? If you say it's MyClass::n1
, then t
isn't really a tuple. If you say it's tuple::n1
, then t
really isn't a MyClass
.
Singles are inherently different from doubles, triples etc in that they only contain a single value.But I can say the same thing about three. Triples are inherently different from singles, doubles, quads, etc. in that they contain exactly three values.
What's so special about one?
(Note: like I said, I see where you're coming from; I'm exaggerating a little bit there. That being said, I don't think that one element should be anywhere as close to a special case as you are advocating. This is rather different, but take vector<bool>
in C++; the intention behind declaring that <bool>
gets its own specialization was a pretty reasonable one, and you could make a good case that <bool>
is reasonably a special case in the language, because it's the only primitive type that could be stored in a single bit if only you could address that. But it turned out to be a big mistake.)