A tutorial on D templates

Jacob Carlborg doob at me.com
Sun Jan 15 03:26:13 PST 2012


On 2012-01-13 22:20, Philippe Sigaud wrote:
> [Cross-posted with D.learn, since it's also a learning-related post]
>
> Hello all,
>
> I discovered D a few years ago and, seeing the recent increase in community
> projects, I looked for a way to bring my own small part to it.
>
> I quite like D templates and wanted to try LaTeX again, so I decided to bite the
> bullet and wrote a tutorial on templates. It's far from finished and most probably
> full of mistakes but since it's already quite big, I need some inputs.
>
> It's a Github project, here:
>
> https://github.com/PhilippeSigaud/D-templates-tutorial
>
> The resulting pdf is there:
>
> 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. What
> section should be expanded, what example would be cool, etc. If you see a mistake,
> do not hesitate to tell me: it's the first time I put thoughts on paper like this.
> Github issues management is far from perfect, but it's usable. Even better would
> be pull requests :)
>
> There is an 'Examples' section where I show what can be done with templates and
> there I 'borrowed' some code posted here, with attribution. I already exchanged
> with Andrej Mitrovic (thanks!), but also took some code from Timon Gehr, Simen
> Kjaeraas, Trass3r and Jacob Carlborg. Guys, if any of you have a problem with
> that, tell me so and I'll take down the code of course. But if any of you could
> give me some explanation (a small paragraph or two?) about what your code does,
> I'll be forever grateful :)
>
> This also extend to anyone who would want to share some template love/lore with
> the rest of us.
>
> Philippe

I see that you have referenced my Orange library, cool. Looking at the 
example for emitting events. I'm not completely sure how it works but it 
looks like that Fields mixin can be replace with the code you have 
referenced from my Orange library and opDispatch. Then you could write 
the Point and Size structs just as regular structs without the mixin.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list