D for Suneido

Pragma Tix pragmatix at orange.fr
Sun Aug 12 12:27:59 PDT 2012


Am 12.08.2012 20:51, schrieb Walter Bright:
> I suspect his problems come mostly from trying to write Java code in D.

Sure, but atm I have no idea what is a good D solution for the following 
problem.


Quote Andrew :
The first thing I ran into was that the lexer returns "tokens", which in 
the Java code are not just integer enums, but actual enum classes with 
fields and methods. ......
In typical new user fashion, I tried to reproduce the Java style token 
enum in D. (It's hard not to avoid "cutting against the grain" when 
learning a new language.) D does allow you to use structs for enums so 
it seemed this would work. But if you use structs then you lose the 
automatic assignment of consecutive integer values, and D struct's are 
value types so they aren't necessarily unique.

end quote

What is the D way here ?





More information about the Digitalmars-d mailing list