Global operator overloading?

Jeremie Pelletier jeremiep at gmail.com
Thu Aug 6 18:28:06 PDT 2009


Are there any plans to have global operator overloading in D?

It would be terribly useful with ranges, since std.array already define range primitives for arrays, I tried to implement array primitives to ranges the same way, ie:

---
bool opEquals(T, U)(T t, U, u) if(isInputRange!T && isInputRange!U) {
	return equal(t, u);
}
---

so I wouldnt have to change every a==b to equal(a, b) when using ranges where built-in arrays were previously used.

Of course if theres another way to do it (other than manually adding opEquals and others to every range declaration in phobos), feel free to suggest it.



More information about the Digitalmars-d mailing list