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

Chapter 9. Code Generation

In this chapter, we will explore D's code generation capabilities and cover the following recipes:

  • Creating user-defined literals

  • Parsing a domain-specific language

  • Generating data structures from text diagrams

  • Automating dynamic calls with multiple dispatch

  • Building a lookup table

  • Using string parameters to change functions

  • Wrapping instance methods

  • Using opDispatch to generate properties

  • Duck typing to a statically-defined interface