Short list with things to finish for D2
Bill Baxter
wbaxter at gmail.com
Thu Nov 19 18:16:15 PST 2009
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
More information about the Digitalmars-d
mailing list