It was a somewhat slow week on the forums so I decided to spend a little extra time on this week's tip (though it quickly struck midnight so I might revisit this again next week).

http://arsdnet.net/this-week-in-d/2016-feb-21.html

There's a fairly big example with comments too. After a couple weeks of talk in the chat room about string mixins, I decided to kinda post a treatise: try to avoid them. But, I'm not one to say "just quit", so I show some alternatives to common requests too.

* no static foreach, but yes template recursion
* no gigantic mixin classes, but yes mixin aliases
* string concatenation is not fun, use helper templates

And a repeated theme from my book: string processing sucks, just write some kind of parser then work with structured data.


If I do return to this next week (no promises!), I might also talk about compile time of interface generators - not compile time interface generators, the compile time OF. Those of you who have worked with them will know that dmd can get very slow and very memory hungry with them.

I've had success in the past by simplifying the CTFE bits - techniques similar to this post - to make very significant compilation time improvements on such things without having the hit at run time that you might be worried about.


But that's another week! For now, enjoy this lengthier tip and sink your teeth into the several techniques briefly covered.

Reply via email to