Re: why no statements inside mixin teplates?

2017-07-27 Thread John Colvin via Digitalmars-d
On Friday, 12 May 2017 at 00:20:13 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there a rational behind not allowing statements inside mixin templates? I know mixin does accept code containing statements, but using mixin is much uglier. so I was wondering. example use case: //--

Re: why no statements inside mixin teplates?

2017-07-27 Thread Domain via Digitalmars-d
On Friday, 12 May 2017 at 20:51:17 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: On Friday, 12 May 2017 at 00:20:13 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there a rational behind not allowing statements inside mixin templates? ... I guess the answer is, nobody has written a DIP for it?

Re: why no statements inside mixin teplates?

2017-05-12 Thread via Digitalmars-d
On Friday, 12 May 2017 at 00:20:13 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there a rational behind not allowing statements inside mixin templates? ... I guess the answer is, nobody has written a DIP for it?

Re: why no statements inside mixin teplates?

2017-05-12 Thread via Digitalmars-d
On Friday, 12 May 2017 at 08:47:32 UTC, visitor wrote: works for me : mixin template testBoilerPlate(alias arg, alias expected) { auto doit = { import std.format : format; auto got = compute(arg); assert(got == expected, "expected %s got %s".format(expected, got));

Re: why no statements inside mixin teplates?

2017-05-12 Thread visitor via Digitalmars-d
On Friday, 12 May 2017 at 09:02:25 UTC, Andrea Fontana wrote: Another error: you want to invoke mixin with testBoilerPlate!(...) not testBoilerPlate(); yes, forgot to add it ...

Re: why no statements inside mixin teplates?

2017-05-12 Thread Andrea Fontana via Digitalmars-d
On Friday, 12 May 2017 at 08:47:32 UTC, visitor wrote: works for me : mixin template testBoilerPlate(alias arg, alias expected) { auto doit = { import std.format : format; auto got = compute(arg); assert(got == expected, "expected %s got %s".format(expected, got));

Re: why no statements inside mixin teplates?

2017-05-12 Thread visitor via Digitalmars-d
On Friday, 12 May 2017 at 00:20:13 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there a rational behind not allowing statements inside mixin templates? I know mixin does accept code containing statements, but using mixin is much uglier. so I was wondering. example use case: //--

why no statements inside mixin teplates?

2017-05-11 Thread via Digitalmars-d
Is there a rational behind not allowing statements inside mixin templates? I know mixin does accept code containing statements, but using mixin is much uglier. so I was wondering. example use case: //- int compute(string) { return 1; } mixin template testBo