compile-time explicitness
Steven Schveighoffer
schveiguy at yahoo.com
Fri Sep 23 11:38:35 PDT 2011
On Fri, 23 Sep 2011 14:15:25 -0400, Gor F. Gyolchanyan
<gor.f.gyolchanyan at gmail.com> wrote:
> It's not a performance issue.
> You can't do this:
>
> if(_ctfe)
> to!string(...);
> else
> toStringNow!(...);
>
> because the toStringNow!(...) won't compile, because it's argument is
> not a
> compile-time value.
Well, first, I was unfamiliar with toStringNow (I thought it was simply a
different function), but second, all you need is a ctfe-able toString
function. to!string should be ctfe-able for many things, a lot of work is
going into making things in phobos more compile-time ready and pure-ready.
> about non-functional style templates:
> When you have a complex computation in your templates, you're forced to
> create
> additional private templates to divide the computation and put it
> together in a
> single expression.
Can you give an example? I'm still not understanding why you can't just
use ctfe.
-Steve
More information about the Digitalmars-d
mailing list