In this chapter, we will explore D's code generation capabilities and cover the following recipes:
opDispatch
to generate propertiesCode generation is a central feature of the D programming language. In fact, it is so important that we've already used it extensively throughout this book! Templates perform code generation. They are a block of code with placeholders which are filled in to form the generated code. With compile-time function evaluation and the mixin
expression, we can build D code out of strings and have them compiled.
Here, we'll look at some specific examples of how to use these techniques to generate code from various inputs.
3.15.144.56