Short list with things to finish for D2
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Nov 20 08:21:32 PST 2009
Pelle Månsson wrote:
> 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?
Well you're better off than before anyway - you get to group operators
in pure and impure.
Andrei
More information about the Digitalmars-d
mailing list