ページの改善
いますぐフォークしてオンライン編集し、このページのプルリクエストを送信します。 Github へのログインが必要です。 これは小さな変更に適しています。 大きな変更を加えたい場合は、通常の cloneの使用をお勧めします。
日本語版について
個人的な学習のために、dlang.orgを翻訳したサイトです。 翻訳に際して、様々なサイトを参考にしています。

String Mixins

String Mixins (not to be confused with template mixins) enable string constants to be compiled as regular D code and inserted into the program. Combining this with compile time manipulation of strings enables the creation of domain-specific languages.

For example, here we can create a template that generates a struct with the named members:

template GenStruct(string Name, string M1)
{
    const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }";
}

mixin(GenStruct!("Foo", "bar"));

which generates:

struct Foo { int bar; }

Superficially, since D mixins can manipulate text and compile the result, it has some similar properties to the C preprocessor. But there are major, fundamental differences: