Jonathan M Davis:

Why wouldn't they be? You can compare int and double, and that's what find and canFind care about.

Right, it's a matter of equality operator.

In my code I was performing canFind on an array of tuples. So I didn't realize that the following code (where both tuple field type and field name are different) is accepted in D (probably I am getting used to the higher type strictness of functional languages):


import std.typecons: Tuple;
alias T1 = Tuple!(int, "x");
alias T2 = Tuple!(double, "y");
void main(string[] args) {
    assert(T1(1) == T2(1));
}


Bye,
bearophile

Reply via email to