2011/6/25 Timon Gehr <timon.g...@gmx.ch>: > String mixins themselves are 'a little bit ugly' (but unquestionably very > useful). > I think the syntax should keep reflecting that. > > Your proposal is a try to make up for Ds lack of macros. I'd prefer macros. > Also overloading the meaning of 'mixin template' seems to be questionable. As > I > understand it, your proposal would make code like this valid?: > > mixin template bar(bool b){ > static if(b){ > enum bar="foo(123);" > }else{ > int foo(int x){ > return 123+x; > } > } > } > > int main(){ > mixin bar!(0); > int x=bar!(1); > assert(x == 246); > } > > This does not seem quite right to me. > > Cheers, > -Timon
Yes, you can write template like that. But it seems to me that is not good even if implicit string mixin is not used. Kenji