Short list with things to finish for D2
Pelle Månsson
pelle.mansson at gmail.com
Fri Nov 20 02:54:46 PST 2009
Andrei Alexandrescu wrote:
> * Encode operators by compile-time strings. For example, instead of the
> plethora of opAdd, opMul, ..., we'd have this:
>
> T opBinary(string op)(T rhs) { ... }
>
> The string is "+", "*", etc. We need to design what happens with
> read-modify-write operators like "+=" (should they be dispatch to a
> different function? etc.) and also what happens with index-and-modify
> operators like "[]=", "[]+=" etc. Should we go with proxies? Absorb them
> in opBinary? Define another dedicated method? etc.
>
> Andrei
What about pure, what about const?
Will we need to
pure T opBinary(string op)(T rhs) if (op == "+" || op == "-") {
static if (op == "+") { /* ... */ }
else static if (op == "-") { /* ... */ }
}
T opBinary(string op)(T rhs) if (op == "+=" || ...) {
// more static if's
}
thereby duplicating every case?
More information about the Digitalmars-d
mailing list