View mode: basic / threaded / horizontal-split · Log in · Help
January 15, 2012
Re: A tutorial on D templates
On 01/14/2012 11:04 PM, Philippe Sigaud wrote:
> On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu
> <SeeWebsiteForEmail@erdani.org>  wrote:
>> On 1/14/12 5:21 AM, Philippe Sigaud wrote:
>>>
>>> Uh, I don't think it'll ever be a book. I didn't write it with a book in
>>> mind.
>>
>> It's organized as a book (TOC, index, structure) and has 141 pages with
>> quite a few more to come. At this point it would be more difficult to make
>> it /not/ a book.
>
> Fair point :)
>
> In my mind, a book is at least 300 pages and, well, professionally
> done. I can see Walter's point about ebook though.

Maybe you should check out the original K&R C book. (The pre-ANSI, 
original edition.)

It is arguably the most referenced single book in the history of 
programming languages, and from its reputation (at least I) assumed it 
to be more than 1000 pages. It is 176 pages, excluding the appendix. And 
it reads like something the guys wrote for their colleagues, not for a 
Book Publisher.

From my own writing, I know that the mere thought of writing a book 
adds an unnecessary burden. So don't. :-)
January 15, 2012
Re: A tutorial on D templates
On 01/14/2012 08:45 PM, Walter Bright wrote:
> On 1/14/2012 7:05 AM, Jeff Nowakowski wrote:
>> On 01/14/2012 03:16 AM, Walter Bright wrote:
>>>
>>> Minor stylistic nit pet peeve of mine: please remove the word "you" and
>>> "your" from the prose.
>>
>> That sounds a bit strict, and looking at one of your articles I see it
>> used in
>> the second sentence: "A pure function does what you'd expect — the
>> compiler
>> enforces purity of the function."
>
> What can I say? Ya got me there. I do tend to write "you", and remove
> them in a later pass.
>
> But let's take some examples from the first page of the text, and see if
> the elidition looks better:

Why don't we just let the guy write his thing in peace, before demanding 
a complete book with stylistically professional grammar and style?

I mean, at this rate we are beating the horse to death before we've even 
put it in front of the carriage. If I were Philippe, by this time I'd be 
stressed out, and the project would start to whither.

How about folks just helping him write it, like he asked?

There's plenty of time to turn it to the Ten Commandments later, but it 
needs to exist before that.
January 15, 2012
Re: A tutorial on D templates
On 1/14/12 6:54 PM, Georg Wrede wrote:
> On 01/14/2012 08:45 PM, Walter Bright wrote:
>> On 1/14/2012 7:05 AM, Jeff Nowakowski wrote:
>>> On 01/14/2012 03:16 AM, Walter Bright wrote:
>>>>
>>>> Minor stylistic nit pet peeve of mine: please remove the word "you" and
>>>> "your" from the prose.
>>>
>>> That sounds a bit strict, and looking at one of your articles I see it
>>> used in
>>> the second sentence: "A pure function does what you'd expect — the
>>> compiler
>>> enforces purity of the function."
>>
>> What can I say? Ya got me there. I do tend to write "you", and remove
>> them in a later pass.
>>
>> But let's take some examples from the first page of the text, and see if
>> the elidition looks better:
>
> Why don't we just let the guy write his thing in peace, before demanding
> a complete book with stylistically professional grammar and style?
>
> I mean, at this rate we are beating the horse to death before we've even
> put it in front of the carriage. If I were Philippe, by this time I'd be
> stressed out, and the project would start to whither.
>
> How about folks just helping him write it, like he asked?
>
> There's plenty of time to turn it to the Ten Commandments later, but it
> needs to exist before that.

He asked for feedback. People sent feedback.

Andrei
January 15, 2012
Re: A tutorial on D templates
> https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf

can't open the pdf with acrobat reader under win7 :(
(the file seems to be ok, contains the pdf header)

im using the latest acrobat reader x
January 15, 2012
Re: A tutorial on D templates
>> https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf
>
>
> can't open the pdf with acrobat reader under win7 :(
> (the file seems to be ok, contains the pdf header)
>
> im using the latest acrobat reader x

Same here. When I regenerated the pdf after cloning the git repository
the pdf doc came out as around 1MB file. The checked in version is
just 20Kb.

Thanks for the tutorial. It is one topic that I find most difficult to grasp.

Regards
January 15, 2012
Re: A tutorial on D templates
On 2012-01-14 22:04, Philippe Sigaud wrote:
> On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu
> <SeeWebsiteForEmail@erdani.org>  wrote:
>> On 1/14/12 5:21 AM, Philippe Sigaud wrote:
>>>
>>> Uh, I don't think it'll ever be a book. I didn't write it with a book in
>>> mind.
>>
>>
>> It's organized as a book (TOC, index, structure) and has 141 pages with
>> quite a few more to come. At this point it would be more difficult to make
>> it /not/ a book.
>
> Fair point :)
>
> In my mind, a book is at least 300 pages and, well, professionally
> done. I can see Walter's point about ebook though.
>
> Thank you all for the encouragements!

Templates is just one part of the language. There are many other parts 
to write about :)

-- 
/Jacob Carlborg
January 15, 2012
Re: A tutorial on D templates
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
January 15, 2012
Re: A tutorial on D templates
On Sun, Jan 15, 2012 at 12:26, Jacob Carlborg <doob@me.com> wrote:
> I see that you have referenced my Orange library, cool.

As for Orange, is it OK with you if I show a small part of it? Is it
OK for me to link to the github project?
Mainly, I wanted to show some tricks you used in util/Reflection.d and
util/Traits.d. I should rummage in your code again.


Btw, I think that by using the technics shown in Nick's last year
article (generating switch/cases from CT information), it would be
possible to make some parameters of Reflection.d be runtime parameters
instead of compile-time.

That is, from hasField!(T, "field") to hasField!T("field"). I do not
know if for serializing it's interesting or not.

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

This mixin comes from Andrej Mitrovic. You should see with him the
difference with Orange, I admit not knowing much about this.

Philippe
January 15, 2012
Re: A tutorial on D templates
On Sun, Jan 15, 2012 at 12:16, Jacob Carlborg <doob@me.com> wrote:
>> Thank you all for the encouragements!
>
>
> Templates is just one part of the language. There are many other parts to
> write about :)

*snort*

I do think a big range tutorial is overdue. Andrei's article is good,
but we need something a bit more detailed / for newbies and shown in
the website. Maybe even a .ddoc file with phobos.

I wonder if we could provide some Ddoc files like this...
January 15, 2012
Re: A tutorial on D templates
On Sun, Jan 15, 2012 at 11:50, d coder <dlang.coder@gmail.com> wrote:

>> can't open the pdf with acrobat reader under win7 :(
>> (the file seems to be ok, contains the pdf header)
>>
>> im using the latest acrobat reader x
>
> Same here. When I regenerated the pdf after cloning the git repository
> the pdf doc came out as around 1MB file. The checked in version is
> just 20Kb.

Yeah, sorry, I probably botched a github exchange when integrating
yesterday's remarks.

I just regenerated the pdf and tested it on both Windows and Linux,
from an integrated pdf viewer in TexWorks, KDE Okular and Acrobat X
and they all work.
I put it in Github 5' ago.

Btw, it's cool you could generate the pdf. Did you have minted and
pygments already installed?

> Thanks for the tutorial. It is one topic that I find most difficult to grasp.

Don't hesitate to tell me where it's unclear. If you have any example
in mind or some difficulty that constantly trip you and that does not
appear in the text, send me a mail, put an issue on github or send me
a pull request.


Philippe
1 2 3 4 5 6 7 8
Top | Discussion index | About this forum | D home