On 1/15/12, Jacob Carlborg <d...@me.com> wrote: > I'm not completely sure how it works but it > looks like that Fields mixin can be replace with the code you have > referenced from my Orange library and opDispatch.
You mean your `fieldsOf` template? I'm not really sure how that would work, I've tried this: This opBinary(string op)(This rhs) { This res; foreach (field; fieldsOf!This) { mixin("res." ~ field ~ " = this." ~ field ~ op ~ " rhs." ~ field ~ ";"); } return res; } But that gives me errors: Error: variable __aggr901 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Error: variable __key902 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Anyway that Fields mixin was something I wrote as a quick example for the book. I've also tried using traits(allMembers), but that didn't work too good.