Book Image

D Cookbook

By : Adam Ruppe
Book Image

D Cookbook

By: Adam Ruppe

Overview of this book

Table of Contents (21 chapters)
D Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


Code 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.