Intro to D metaprogramming - Creating a JSON serialiser

A series which covers the creation of a basic JSON serialiser in D while teaching several different aspects of D's metaprogramming: templates; template arguments; function contracts; static if; static foreach; mixins, and more.
  1. Serialising basic D types
  2. Serialising basic D types - Alternative function layout
  3. Serialising structs
  4. Serialising enums and classes
  5. Serialising arrays
  6. Using UDAs for customisation
  7. Mixin template to automate static deserialise

Metaprogramming in D

D boasts one of the strongest, most flexible array of metaprogramming features amongst most existing languages, which allows it the ability to perform use-cases such as automating boilerplate without the need of external tooling; generating compiler optimised D code from a regex at compile-time; and running functions at compile-time to generate values/more code. All done using the language's built-in features with little compromise.
  1. Text templates that can execute code at compile-time


  1. A life wasted - The ramblings of a madman