Bill Baxter wrote:
On Thu, Nov 19, 2009 at 8:46 AM, Andrei Alexandrescu
<[email protected]> 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

Reply via email to