PROPOSAL: opSeq()
downs
default_357-line at yahoo.de
Mon Apr 7 16:53:01 PDT 2008
Bill Baxter wrote:
> I believe Walter's response previously has been that we should just get
> used to looking at things like:
>
> my_for(i=0,i<10,i++,{<code>});
>
> instead of adding complications to the grammar to support such things.
>
> --bb
FWIW and just FYI, the least closing brackets can be done with my_for(i=0, i<10, i++) = {<code>}; using an overloaded opAssign.
To make it flexible, template opAssign and make it lazy to allow chaining; i.e. my_for(...) = your_for(...) = {<code>};
For example, I use this in dglut:
const string LazyCall="
static if (is(T==void)) t();
else static if (is(T==void delegate())) t()();
else static assert(false, T.stringof);
";
Of course, I'd still rather have trailing DGs or full infix support. ^^
--downs
More information about the Digitalmars-d
mailing list