Am 22.08.2014 21:15, schrieb Andrej Mitrovic via Digitalmars-d:
On 8/22/14, Sönke Ludwig <digitalmars-d@puremagic.com> wrote:
Docs: http://s-ludwig.github.io/std_data_json/

This confused me for a solid minute:

// Lex a JSON string into a lazy range of tokens
auto tokens = lexJSON(`{"name": "Peter", "age": 42}`);

with (JSONToken.Kind) {
     assert(tokens.map!(t => t.kind).equal(
         [objectStart, string, colon, string, comma,
         string, colon, number, objectEnd]));
}

Generally I'd avoid using de-facto reserved names as enum member names
(e.g. string).


Hmmm, but it *is* a string. Isn't the problem more the use of with in this case? Maybe the example should just use with(JSONToken) and then Kind.string?

Reply via email to