ctfe reduction

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 21 11:51:48 PDT 2017


On Tuesday, 21 March 2017 at 17:56:33 UTC, StarGrazer wrote:
> One problem with ctfe's is that the compiler is a bit ignorant.
>
> e.g.,
>
> auto e = X!"y";
>
> It is clear that e, when defined is a manifest constant(simply 
> because one can do)
>
> enum ee = X!"y";
> auto e = ee;
>
> But one can't do
>
> auto e = X!"y";
> pragma(msg, e);
>
>
> yet one can do
>
> enum ee = X!"y";
> auto e = ee;
> pragma(msg, ee);
>
>
> It seems that the compiler can be smart enough to figure this 
> out.

Explicit is better than implicit.
Simple is better than complex.

Beware of compilers "figuring out" things for you.


More information about the Digitalmars-d mailing list