A tutorial on D templates

Philippe Sigaud philippe.sigaud at gmail.com
Sat Jan 14 15:03:04 PST 2012


On Sat, Jan 14, 2012 at 16:56, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 1/13/12 3:20 PM, Philippe Sigaud wrote:

> "They are used everywhere in Phobos, D standard library and any D user
> should know about them." -> "They are used everywhere in Phobos---D's
> standard library---and therefore any D user should know about them."

Done.

> "But, based on C++’s templates as they are, they can be a bit daunting at
> first." -> "But, based on C++’s templates as they are, D templates can be a
> bit daunting at first."

Done.

> "Well, D’s sane syntax for templates, nifty things like static if, alias or
> tuples cured me of that impression." -> "Well, D’s sane syntax for templates
> and nifty features such as static if, alias, or tuples, cured me of that
> impression." (Generally prefer "such as" to "like".)

Done.

> "I hope this docu- ment will help you also." -> "I hope this docu- ment will
> help you, too."

Done.

> "Part III presents other metaprogramming tools: string mixins (18), compile-
> time function evaluation (19) and __traits (20)." -> "Part III presents
> other metaprogramming tools: string mixins (18), compile- time function
> evaluation (19), and __traits (20)." (Use the "Oxford comma" throughout.)

Done (well, not the Oxford comma)

> "template-y" -> "\mbox{template-y}"

Done.

> I think italics for comments look a bit baroque, how about slanted text?

pygments/minted do not do slanted. I modifyed my own "borland.py" to
get non-slanted comments. Anyone generating the pdf from the .tex
files will get another highlighting, though.


> "...in the next sections (You’ll see for example..." -> "...in the next
> sections (you’ll see for example..."

Done.

> "... except inside a (standard) function." -> "except inside a (regular)
> function."

Done.

> Would be great to adjust the code formatting package to not number examples
> of 1 line long.

Done. Now, only code samples where I refer to some lines are numbered.

> "Templates Building Blocks" -> "Template Building Blocks"

Done.

> "Up to now, templates must seem not that interesting to you..." -> "Up to
> now, templates may not seem all that interesting..."

Done.

> "It’s both an expression and a declaration, so I’ll call it a construct." ->
> "It’s both a statement and a declaration, so I’ll call it a construct." In
> fact you can call it a declaration because some declarations may occur
> wherever a statement is allowed.

Done.

Thanks for the comments!


More information about the Digitalmars-d-announce mailing list