http://d.puremagic.com/issues/show_bug.cgi?id=5660


Adam D. Ruppe <destructiona...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructiona...@gmail.com


--- Comment #8 from Adam D. Ruppe <destructiona...@gmail.com> 2012-07-29 
07:51:55 PDT ---
// this is your sugar!
string yield(string what) { return `if(auto result = dg(`~what~`)) return
result;`; }


Now, every time you would write

        result = dg(y);
        if (result)
            return result;

instead write:

mixin(yield("y"));

Or mixin(yield("i, y")); if you have multiple arguments.


And the boilerplate is way down. Since you keep result around,
you'll want to make it just if(result) instead of if(auto result),
but the idea is the same.


We might be able to make a class template or a mixn for
yield(int) hanoiTower() too, but writing int opApply(...)
isn't too bad.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to