bug in pragma?

Dicebot public at dicebot.lv
Thu Jul 4 16:01:28 PDT 2013


On Thursday, 4 July 2013 at 22:48:50 UTC, JS wrote:
> This is simply wrong. If s could not be used at compile time 
> then the mixin could not be used at compile time... yet it can 
> be and is being used and works fine when the pragma is 
> removed... and one can even pragma the template name after the 
> function and it will work.

You are mixing together compile-time values and CTFE. While 
result of CTFE function is treated as compile-time value, 
anything inside acts quite similar to normal code. And pragma's 
are limited to pure compile-time stuff, like enum values.

There is a proposal to add ctfeWriteln construct to help in such 
situation - it can be recognized by CTFE interpreter and ignored 
during run-time. But I don't know if it will be accepted.


More information about the Digitalmars-d mailing list