On 16/12/2014 4:31 p.m., evenex wrote:
On Tuesday, 16 December 2014 at 00:32:27 UTC, Rikki Cattermole wrote:
Something I've learned while working with templates in D is, there is
a very specific way to write them. Especially to work at compile time.
I'm wondering if you were fighting the compiler because of this.
What specific way do you mean? I don't often get the feeling that I'm
fighting the compiler (like I often do in C++), but it can be hard to
say what's a compiler error and whats my own mistake.
Its mostly for CTFE, not stuff your general dev will touch even in D.
Like generating javascript from data models or routes [0].
Summary:
"Helper functions" where by they have one task that does not change, and
can be gained purely from the parameters given (mostly template args).
"Generator functions" where by they do some task that requires "helper
functions" but cannot be ran at CTFE or generate code to be ran at runtime.
I started writing a small booklet on this, if you got an email if you're
interested or some way to send you. Please let me know.
[0]
https://github.com/rikkimax/Cmsed/tree/master/source/base/cmsed/base/internal/generators/js