std.d.lexer : voting thread

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 8 21:38:01 PDT 2013


On 10/8/13 9:32 PM, deadalnix wrote:
> Overall, I think this is going into the right direction. However, there
> is one thing I don't like with that design.
>
> When you go throw the big switch of death, you match the beginning of
> the string and then you go back to a function that will test where does
> it come from and act accordingly. That is kind of wasteful.
>
> What SDC does is that it calls a function-template with the part matched
> by the big switch of death passed as template argument. The nice thing
> about it is that it is easy to trnsform this compile time argument into
> a runtime one by simply forwarding it (what is done to parse identifier
> that begins by a keyword for instance).

I think a bit of code would make all that much clearer.

Andrei



More information about the Digitalmars-d mailing list