A tutorial on D templates

Philippe Sigaud philippe.sigaud at gmail.com
Sat Jan 14 09:08:05 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:
>>
>>
>> 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?

I'd prefer you to wait a bit, because I think I didn't some code
samples and they either do not compile or produce different results.
That'd badly reflect on D.

Maybe I'll write a small script to extract code samples and compile
them. Do you have anything like this for TPDL?

I have a problem with implicit main() and/or presenting in one sample
code that should be in the global scope and some that must be put into
a main.
I wondered whether I should present only 'compile-as-shown' examples,
which means putting import statements and void main() {/* some code
*/} everywhere.

>
> 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.

Thanks for the compliments and thanks for the suggestions!
Indeed, the introductory text was not my main goal while writing this :)

I also discovered something you explained when you were writing TDPL:
it's difficult to find interesting examples that don't use
soon-to-be-introduced features.

(snip corrections).

Thanks a lot, I'll make them issues and correct this.


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

I asked myself the same question. I'll dive into pygment's formatting script.


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

I tried to get two different D environments, one with numbered lines
(only when I want to refer to a line, that's less than 5% of all code
samples) and an unnumbered one, but it didn't work. I'll try again.

Philippe


More information about the Digitalmars-d-announce mailing list