A Class in Composition

Chris wendlec at tcd.ie
Fri Aug 30 08:32:36 PDT 2013


I re-used the components (see above) in a different program 
(again a parser with different needs) and I ended up with more or 
less the same one-liner.

auto dictionary = Lexicon(); // output range
string[string] lex = arr.byEntry().copy(dictionary).lexicon;

The only change necessary was the logic bit in the Entry struct 
(two lines had to be changed). I could emit the byComment() bit, 
because there are no comments in the source, without any 
complaints or side effects. Great stuff!


More information about the Digitalmars-d mailing list