This question came up in the pulls.

Given two different Tuple types, it is possible to run an operator on said tuples, if the operator is legal for each individual field in the tuple. For example.

//----
import std.typecons;

void main()
{
auto a = Tuple!( int, const(char)[])( 2, "what".dup); auto b = Tuple!(short, immutable(char)[])(cast(short)1, "hello");
    a = b;
    assert(a == b);
    assert(!(a < b));
    assert(!(a < b));
    assert(!(a > b));
}
//----

I'm not really sure if this was really ever meant to work this way, or if the implementation got luck and allowed it. The documentation isn't really very clear about it.

In any case, it begs the question: *Should* Tuples be allowed to do this?

The rationale for them *not* being allowed is that the Types are different, and for standard aggregate structs, this would not be legal, *even if* each field can be cast from one to the other. Why should Tuple allow it?

Stances on the matter?

Reply via email to