Short list with things to finish for D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 19 18:25:42 PST 2009


Bill Baxter wrote:
> On Thu, Nov 19, 2009 at 8:46 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> grauzone wrote:
>>> What's with opSomethingAssign (or "expr1[expr2] @= expr3" in general)?
>>> opBinary doesn't seem to solve any of those.
>> opBinary does solve opIndex* morass because it only adds one function per
>> category, not one function per operator. For example:
>>
>> struct T {
>>    // op can be "=", "+=", "-=" etc.
>>    E opAssign(string op)(E rhs) { ... }
>>    // op can be "=", "+=", "-=" etc.
>>    E opIndexAssign(string op)(size_t i, E rhs) { ... }
>> }
> 
> Rewrite
> a.prop = x;   =>    a.opPropertyAssign!("prop", "=")(x);
> 
> to that and we're really getting somewhere!
> 
> --bb

I swear I was thinking of that.

Andrei



More information about the Digitalmars-d mailing list