Re: need help with CTFE

2015-03-26 Thread anonymous via Digitalmars-d-learn
On Thursday, 26 March 2015 at 16:19:17 UTC, Dmitri Makarov wrote: When I compile version DOES_NOT_WORK, I get the following error: c/tool.d(13): Error: variable name cannot be read at compile time c/tool.d(13):while looking for match for hasMember!(Tool, name) However, the other

need help with CTFE

2015-03-26 Thread Dmitri Makarov via Digitalmars-d-learn
I'm compiling the following application (2 d modules) // file c/tool.d module c.tool; struct Tool { string name; auto generate() { version (DOES_NOT_WORK) { import std.traits : hasMember; if (hasMember!(Tool, name)) return `writeln(this is a ` ~ mixin (this. ~

Re: need help with CTFE

2015-03-26 Thread Dmitri Makarov via Digitalmars-d-learn
On Thursday, 26 March 2015 at 17:30:40 UTC, anonymous wrote: value parameter. You cannot do that, because `name` is a dynamic value but you can only pass a static value there. (There may be better terms than dynamic/static value.) Thank you, anonymous. It makes sense. I guess rather than