Regular Templates May Be `mixin`d?
Paul Backus
snarwin at gmail.com
Sun Oct 3 03:04:29 UTC 2021
On Sunday, 3 October 2021 at 02:52:20 UTC, surlymoor wrote:
> This compiles and works. I checked the spec, and I don't see
> anything; probably missed it, however; mentioning the fact that
> regular templates may be used with `mixin`. Is this expected?
Yes, this is intentional and expected. From the spec:
> A TemplateMixin takes an arbitrary set of declarations from the
> body of a TemplateDeclaration and inserts them into the current
> context.
Source: https://dlang.org/spec/template-mixin.html
Notice that it is specified to work with any template
declaration, not just one declared as a `mixin template`.
More information about the Digitalmars-d-learn
mailing list