A tutorial on D templates

Philippe Sigaud philippe.sigaud at gmail.com
Mon Jan 16 15:10:41 PST 2012

On Mon, Jan 16, 2012 at 17:36, Simen Kjærås <simen.kjaras at gmail.com> wrote:
> The extended enum example does not compile, because you've removed the
> unittest{} block around the the tests. I'd say the code in your document
> should compile straight out of the box, to be newb-friendly.

Yeah. I just coded a small D script that extract all code samples,
compile them and store the result in a log.
That way, I can now slowly make all samples compile.

I hesitate between showing the boilerplate or not (imports, empty
mains or code in main...)

> As for an explanation:

> This code generates an enum definition as a string, by taking all the
> members of the old enum, and adding those passed in string parameter s,
> and mixing it in.

Thanks! I'll add it.

More information about the Digitalmars-d-learn mailing list