On Sunday, 12 August 2012 at 23:35:39 UTC, bearophile wrote:
Pragma Tix:

2) http://thesoftwarelife.blogspot.fr/2012/08/d-tours.html

From the blog post:

-----------------------

Another minor annoyance was the lack of an equivalent to Java's static import. If I want to refer to the tokens as just IF or ELSE I could make them "anonymous". But then they don't have a specific type. Or I can give the enum a named type, but then I have to always reference them with Token.IF . In Java I could say import static Token.* and then just use the bare names.

This helps:

with(Token) {
    // lot and lot of code here
}

 Done that before :) Quite heavily in one of my sources.

Glancing at the code for his lexer I wonder if the approach is right. I've only written a couple half lexers for minor projects, but he's duplicating what's in std.range & std.ascii; Also his structure and methods go twoards suggesting he's making a range but not working with D on it (next, nextAll vs front, popFront).

Wouldn't an actual range for his tokens/lexer be better (which then creates/calculates and returns the current token)? I've done this once in one of my projects and it actually turned out to work very well.

Reply via email to