Lazy evaluation of enum members
Jonathan M Davis
jmdavisProg at gmx.com
Fri Sep 20 11:06:29 PDT 2013
On Friday, September 20, 2013 09:10:10 Walter Bright wrote:
> Enum member forward references now work:
>
> void main()
> {
> enum E
> {
> A = B,
> E = D + 7,
> B = 3,
> C,
> D,
> }
>
> assert(E.A == 3);
> assert(E.B == 3);
> assert(E.C == 4);
> assert(E.D == 5);
> assert(E.E == 12);
> assert(E.max == 12);
> }
>
> https://github.com/D-Programming-Language/dmd/pull/2568
>
> Once this is pulled, I intend to extend it so that enum members for imports
> are not semantically evaluated at all unless they are used. This is a first
> step to making all semantic evaluation of imports lazy, which should give
> us a big boost in compilation speed, as well as do a much better job at
> handling forward references.
>
> I've been meaning to do this for some time, starting with enums because they
> are the easiest.
But if you make the compiler too fast, then this XKCD won't be true anymore!
;)
http://xkcd.com/303/
- Jonathan M Davis
More information about the Digitalmars-d
mailing list