A tutorial on D templates
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Jan 14 07:56:41 PST 2012
On 1/13/12 3:20 PM, Philippe Sigaud wrote:
> https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf
>
> (click on View Raw)
>
> If you have any comment, criticism, explanation, what have you, I'm game.
This is great! Should I post to reddit, or hold off a bit more?
The document is informative, well written, and beautifully formatted. I
found the introduction a bit difficult to get into, so I'm submitting a
few suggestions below. I didn't have time to get through everything, but
anyway the quality of the text improves very much once it gets into the
material.
"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."
"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."
"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".)
"I hope this docu- ment will help you also." -> "I hope this docu- ment
will help you, too."
"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.)
"template-y" -> "\mbox{template-y}"
I think italics for comments look a bit baroque, how about slanted text?
"...in the next sections (You’ll see for example..." -> "...in the next
sections (you’ll see for example..."
"... except inside a (standard) function." -> "except inside a (regular)
function."
Would be great to adjust the code formatting package to not number
examples of 1 line long.
"Templates Building Blocks" -> "Template Building Blocks"
"Up to now, templates must seem not that interesting to you..." -> "Up
to now, templates may not seem all that interesting..."
"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.
Andrei
More information about the Digitalmars-d-announce
mailing list