digitalmars.D.announce - A tutorial on D templates
- Philippe Sigaud (27/27) Jan 13 2012 [Cross-posted with D.learn, since it's also a learning-related post]
- bearophile (14/17) Jan 13 2012 I am using a pdf blocking plug-in, that causes that GitHub link to save ...
- Philippe Sigaud (12/18) Jan 14 2012 On the main project page, there is a Zip icon on the left, to download
- Walter Bright (15/17) Jan 14 2012 I see you've already done a great deal of work on this, it looks nice! I...
- Jonathan M Davis (9/35) Jan 14 2012 I confess that it's a bit of a pet peeve of mine when people insist on
- Walter Bright (6/13) Jan 14 2012 (though it is true that it can be avoided fairly easily)
- Jonathan M Davis (10/21) Jan 14 2012 There are certainly times when reducing how much "you" is used reduces t...
- Walter Bright (13/22) Jan 14 2012 You and I are going to disagree on this.
- Jonathan M Davis (3/4) Jan 14 2012 I didn't really expect otherwise.
- Nick Sabalausky (15/18) Jan 14 2012 Dosn't the reader mean "The reader and I are going to disagree on this"?...
- Walter Bright (9/26) Jan 14 2012 I agree with your comment about "the reader" being pretentious.
- Nick Sabalausky (4/37) Jan 16 2012 Yup, just kidding on that like I said. :)
- Andrei Alexandrescu (9/17) Jan 14 2012 Since we're on this topic I can't stop picking - all in good fun I hope
- Philippe Sigaud (3/5) Jan 14 2012 :) I do the same.
- Timon Gehr (3/25) Jan 14 2012 In longer posts, I think the information is often laid out in an
- Walter Bright (2/4) Jan 14 2012 We're not in Notlob, you know.
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (5/27) Jan 14 2012 I've always wanted to say the same but I couldn't be sure that I
- Andrei Alexandrescu (7/24) Jan 14 2012 "You" can convey a conversational, intimate tone that can be helpful.
- deadalnix (5/22) Feb 08 2012 « The linker will fluently and baroquely remind you of that in its
- Philippe Sigaud (11/25) Jan 14 2012 Thanks. LaTeX work, mostly. At one time, I asked Andrei for the latex
- Walter Bright (11/19) Jan 14 2012 It looks like a book, and I see no reason why it can't be. It'll see far...
- deadalnix (7/10) Feb 08 2012 A good practice is to back up coloring with some other tools to convey
- Andrei Alexandrescu (5/6) Jan 14 2012 It's organized as a book (TOC, index, structure) and has 141 pages with
- Philippe Sigaud (6/13) Jan 14 2012 Fair point :)
- Nick Sabalausky (3/18) Jan 14 2012 I have plenty of physical books that are shorter than that!
- Andrei Alexandrescu (7/22) Jan 14 2012 Great. With the publishing world undergoing quite some stir, I think it
- Georg Wrede (10/23) Jan 14 2012 Maybe you should check out the original K&R C book. (The pre-ANSI,
- Jacob Carlborg (5/20) Jan 15 2012 Templates is just one part of the language. There are many other parts
- Philippe Sigaud (6/9) Jan 15 2012 *snort*
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/16) Jan 15 2012 I am hoping that this is good enough for now:
- Walter Bright (2/4) Jan 15 2012 Very nice, I'll read it more carefully later.
- Walter Bright (4/6) Jan 15 2012 Please, can you turn this into a Kindle ebook? Both the Turkish and Engl...
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/10) Jan 15 2012 Thank you. Will do! :)
- Philippe Sigaud (8/12) Jan 15 2012 It sure is! This should be advertised somehow. Maybe add a link in the D...
- Andrei Alexandrescu (3/12) Jan 15 2012 Should I redditize?
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/17) Jan 16 2012 If that question was for me, of course I wouldn't mind, at all. ;)
- Walter Bright (2/5) Jan 15 2012 Yeah, we badly need a "The Range Manifesto".
- Jeff Nowakowski (4/6) Jan 14 2012 That sounds a bit strict, and looking at one of your articles I see it
- Walter Bright (25/32) Jan 14 2012 What can I say? Ya got me there. I do tend to write "you", and remove th...
- Andrej Mitrovic (2/2) Jan 14 2012 Counter-argument: You can't make a pull request to a book. Just take a
- Walter Bright (2/4) Jan 14 2012 Ebooks can be fixed easily. Print books cannot.
- Nick Sabalausky (5/12) Jan 14 2012 This particular one, I honestly think the "before" sounds better. But I...
- Georg Wrede (9/24) Jan 14 2012 Why don't we just let the guy write his thing in peace, before demanding...
- Andrei Alexandrescu (3/29) Jan 14 2012 He asked for feedback. People sent feedback.
- Philippe Sigaud (7/20) Jan 15 2012 No problemo, Georg. I'm not stressed at all by the grammar / style remar...
- Walter Bright (4/6) Jan 15 2012 Nothing worse than silence!
- Jesse Phillips (9/19) Jan 15 2012 Getting feedback on writing style early is a great plus to the
- Zachary Lund (3/3) Jan 14 2012 On page 78 where template mixins are discussed, some of the variable
- Philippe Sigaud (3/5) Jan 14 2012 OK, added as an issue.
- Philippe Sigaud (2/4) Jan 14 2012 OK, done. Tell me if it's better?
- Andrei Alexandrescu (40/43) Jan 14 2012 This is great! Should I post to reddit, or hold off a bit more?
- Andrei Alexandrescu (7/7) Jan 14 2012 On 1/14/12 9:56 AM, Andrei Alexandrescu wrote:
- Philippe Sigaud (5/11) Jan 14 2012 I hesitated on this. OK, I'll try, I made it an issue.
- Andrei Alexandrescu (4/16) Jan 14 2012 Code samples should be able to span multiple pages. Never heard a
- Philippe Sigaud (5/11) Jan 14 2012 OK, done.
- Philippe Sigaud (25/41) Jan 14 2012 I'd prefer you to wait a bit, because I think I didn't some code
- Andrei Alexandrescu (8/32) Jan 14 2012 Yah, I defined several LaTeX environments and a little syntax for that.
- Philippe Sigaud (3/17) Jan 14 2012 OK.
- Philippe Sigaud (28/60) Jan 14 2012 Done.
- dennis luehring (3/4) Jan 15 2012 can't open the pdf with acrobat reader under win7 :(
- d coder (5/9) Jan 15 2012 Same here. When I regenerated the pdf after cloning the git repository
- Philippe Sigaud (14/22) Jan 15 2012 Yeah, sorry, I probably botched a github exchange when integrating
- d coder (3/9) Jan 15 2012 Thanks. I have just started reading your tutorial. And I am a slow learn...
- Nick Sabalausky (4/6) Jan 16 2012 Eewww. Do youself a favor and grab a copy of FoxIt Reader. Works just a...
- Philippe Sigaud (6/13) Jan 17 2012 st as
- Jacob Carlborg (8/35) Jan 15 2012 I see that you have referenced my Orange library, cool. Looking at the
- Philippe Sigaud (14/20) Jan 15 2012 As for Orange, is it OK with you if I show a small part of it? Is it
- Jacob Carlborg (7/27) Jan 15 2012 Do you have a link?
- Philippe Sigaud (3/11) Jan 15 2012 Sure:
- Andrej Mitrovic (22/25) Jan 16 2012 You mean your `fieldsOf` template? I'm not really sure how that would
- Jacob Carlborg (22/47) Jan 16 2012 This compiles and run as expected for me using dmd 2.057:
- Andrej Mitrovic (2/2) Jan 16 2012 Ah, I completely forgot about tupleof. That could work. Originally
- Jacob Carlborg (5/7) Jan 16 2012 No problem. Although tupleof works for private and protected fields as
[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
Jan 13 2012
Philippe Sigaud:https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf (click on View Raw)I am using a pdf blocking plug-in, that causes that GitHub link to save a fake pdf file :-( Is your tutorial containing the (a,b) => a * b syntax too? I'd like operators in your text to have a space around: a * b instead of a*b (Unless the space is finishing on the line). In my opinion foo!q{ a * b } Is more readable than: foo!"a*b" Bye, bearophile
Jan 13 2012
On Fri, Jan 13, 2012 at 23:07, bearophile <bearophileHUGS lycos.com> wrote:Philippe Sigaud:On the main project page, there is a Zip icon on the left, to download the entire project as a zip, pdf included. Of course, if you've git installed: $ git clone git github.com:PhilippeSigaud/D-Template-Tutorial.git should do the trick.https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf (click on View Raw)I am using a pdf blocking plug-in, that causes that GitHub link to save a fake pdf file :-(Is your tutorial containing the (a,b) => a * b syntax too?A bit. I began in september and had to change bits due to D evolutions:) (CTFE opening new possibilities and this new syntax). But I still have many things to change, and I didn't explain this syntax. If you want to discuss the text, I propose we do it on D.learn, so as not to pollute D.announce too much. Philippe
Jan 14 2012
On 1/13/2012 1:20 PM, Philippe Sigaud wrote:This also extend to anyone who would want to share some template love/lore with the rest of us.I see you've already done a great deal of work on this, it looks nice! I strongly encourage you to continue with it, and release it as a book. We could sure use another book on D! I strongly suggest making the formatting work for a Kindle edition of your book. PDF files do badly on e-readers. Minor stylistic nit pet peeve of mine: please remove the word "you" and "your" from the prose. It's nearly always redundant, and the sentences flow better without it. "You" is a filler word, similar to "um", "like", and "basically". For example, Like, I basically think that you will basically prefer the, um, text once basically you, like, remove basically them, like, ok. Know what I'm saying? => The text will look better without them. :-)
Jan 14 2012
On Saturday, January 14, 2012 00:16:37 Walter Bright wrote:On 1/13/2012 1:20 PM, Philippe Sigaud wrote:I confess that it's a bit of a pet peeve of mine when people insist on avoiding words like you and your. I completely disagree that it's a problem. And there are times where avoiding it can cause problems and make the text more awkward (though it is true that you can often avoid it fairly easily if you really want to). But I know that there are plenty of technical writers who would agree with you. - Jonathan M DavisThis also extend to anyone who would want to share some template love/lore with the rest of us.I see you've already done a great deal of work on this, it looks nice! I strongly encourage you to continue with it, and release it as a book. We could sure use another book on D! I strongly suggest making the formatting work for a Kindle edition of your book. PDF files do badly on e-readers. Minor stylistic nit pet peeve of mine: please remove the word "you" and "your" from the prose. It's nearly always redundant, and the sentences flow better without it. "You" is a filler word, similar to "um", "like", and "basically". For example, Like, I basically think that you will basically prefer the, um, text once basically you, like, remove basically them, like, ok. Know what I'm saying? => The text will look better without them. :-)
Jan 14 2012
On 1/14/2012 12:36 AM, Jonathan M Davis wrote:I confess that it's a bit of a pet peeve of mine when people insist on avoiding words like you and your. I completely disagree that it's a problem. And there are times where avoiding it can cause problems and make the text more awkward (though it is true that you can often avoid it fairly easily if you really want to).(though it is true that it can be avoided fairly easily) Fixed that for you. What advantage does the "you" version have, besides upping the word count?But I know that there are plenty of technical writers who would agree with you.I cannot recall any professional technical book that used "you" (yes, I'm sure you can find an example!). It's like wearing jeans to a wedding.
Jan 14 2012
On Saturday, January 14, 2012 10:26:22 Walter Bright wrote:On 1/14/2012 12:36 AM, Jonathan M Davis wrote:There are certainly times when reducing how much "you" is used reduces the amount of text at no extra cost, but there are other times, when it's far more natural to use "you," and it can become harder to produce sentences without completely reworking that section of text if "you" is removed. And honestly, it just seems overly picky to me. Sure, it can reduce the word count, but I really don't think that it does all that much to improve the quality of the text, and it can require quite a bit more work, since it tends to be unnatural to avoid "you" in the way that technical writers like to. - Jonathan M DavisI confess that it's a bit of a pet peeve of mine when people insist on avoiding words like you and your. I completely disagree that it's a problem. And there are times where avoiding it can cause problems and make the text more awkward (though it is true that you can often avoid it fairly easily if you really want to).(though it is true that it can be avoided fairly easily) Fixed that for you. What advantage does the "you" version have, besides upping the word count?
Jan 14 2012
On 1/14/2012 11:00 AM, Jonathan M Davis wrote:There are certainly times when reducing how much "you" is used reduces the amount of text at no extra cost, but there are other times, when it's far more natural to use "you," and it can become harder to produce sentences without completely reworking that section of text if "you" is removed. And honestly, it just seems overly picky to me. Sure, it can reduce the word count, but I really don't think that it does all that much to improve the quality of the text, and it can require quite a bit more work, since it tends to be unnatural to avoid "you" in the way that technical writers like to.You and I are going to disagree on this. But I will add that excessive use of "you" in technically minded books tends to, in my mind, reduce the book a grade in quality. This is not a decision I consciously make, it's just that it doesn't read like a professional technical book would. In fact, it took me a while to figure out why I didn't find certain texts to be professional sounding. Like I said, it's like wearing jeans to a wedding. It doesn't matter how nice the jeans are, or that jeans are appropriate in other contexts. It doesn't matter how you feel about it. Strunk & White's "The Elements of Style" rule 17: Omit Needless Wordsand it can require quite a bit more work,This is not an issue. The whole of the document can be fixed in a handful of minutes.
Jan 14 2012
On Saturday, January 14, 2012 11:30:25 Walter Bright wrote:You and I are going to disagree on this.I didn't really expect otherwise. - Jonathan M Davis
Jan 14 2012
"Walter Bright" <newshound2 digitalmars.com> wrote in message news:jesl4i$30v3$1 digitalmars.com...You and I are going to disagree on this.Dosn't the reader mean "The reader and I are going to disagree on this"? ;) (only j/k, of course. Although I have always hated when authors say "the reader" instead of "you" which is what was obviously meant anyway. I just sounds bad. I always read it as a clear sign the author was trying *way* too hard to be "correct".)But I will add that excessive use of "you" in technically minded books tends to, in my mind, reduce the book a grade in quality.The key there is "excessive use", not "any use". Eliminating excessive use of "you" certainly improves the quality. But compulsively eliminating "you", at best, makes the text sound pedantic, at worst, decreases the quality. Either way, compulsively eliminating it leads to pointless contrivances and awkward euphemisms like "the reader". (Much like my use of "like" in the previous sentence. Yes, "like" can be filler, but changing that sentence to use "such as" would have done nothing but...pointlessly increase the word count.)
Jan 14 2012
On 1/14/2012 1:00 PM, Nick Sabalausky wrote:"Walter Bright"<newshound2 digitalmars.com> wrote in message news:jesl4i$30v3$1 digitalmars.com...I agree with your comment about "the reader" being pretentious. As for my use of "you" there, I was talking specifically to Jonathan. That's different from writing a tech manual. Wearing jeans is appropriate in a conversation.You and I are going to disagree on this.Dosn't the reader mean "The reader and I are going to disagree on this"? ;) (only j/k, of course. Although I have always hated when authors say "the reader" instead of "you" which is what was obviously meant anyway. I just sounds bad. I always read it as a clear sign the author was trying *way* too hard to be "correct".)The steps are: Novice: follow the rules because you're told to Master: follow the rules because you understand the rules Guru: break the rules because you know the limits of the rulesBut I will add that excessive use of "you" in technically minded books tends to, in my mind, reduce the book a grade in quality.The key there is "excessive use", not "any use". Eliminating excessive use of "you" certainly improves the quality. But compulsively eliminating "you", at best, makes the text sound pedantic, at worst, decreases the quality. Either way, compulsively eliminating it leads to pointless contrivances and awkward euphemisms like "the reader".
Jan 14 2012
"Walter Bright" <newshound2 digitalmars.com> wrote in message news:jet0kk$1h97$1 digitalmars.com...On 1/14/2012 1:00 PM, Nick Sabalausky wrote:Yup, just kidding on that like I said. :)"Walter Bright"<newshound2 digitalmars.com> wrote in message news:jesl4i$30v3$1 digitalmars.com...I agree with your comment about "the reader" being pretentious. As for my use of "you" there, I was talking specifically to Jonathan. That's different from writing a tech manual. Wearing jeans is appropriate in a conversation.You and I are going to disagree on this.Dosn't the reader mean "The reader and I are going to disagree on this"? ;) (only j/k, of course. Although I have always hated when authors say "the reader" instead of "you" which is what was obviously meant anyway. I just sounds bad. I always read it as a clear sign the author was trying *way* too hard to be "correct".)Very, very true.The steps are: Novice: follow the rules because you're told to Master: follow the rules because you understand the rules Guru: break the rules because you know the limits of the rulesBut I will add that excessive use of "you" in technically minded books tends to, in my mind, reduce the book a grade in quality.The key there is "excessive use", not "any use". Eliminating excessive use of "you" certainly improves the quality. But compulsively eliminating "you", at best, makes the text sound pedantic, at worst, decreases the quality. Either way, compulsively eliminating it leads to pointless contrivances and awkward euphemisms like "the reader".
Jan 16 2012
Since we're on this topic I can't stop picking - all in good fun I hope - on Jonathan, the master of words. The following two sentences convey the same exact information: 1.There are certainly times when reducing how much "you" is used reduces the amount of text at no extra cost, but there are other times, when it's far more natural to use "you," and it can become harder to produce sentences without completely reworking that section of text if "you" is removed.2.Sure, it can reduce the word count, but I really don't think that it does all that much to improve the quality of the text, and it can require quite a bit more work, since it tends to be unnatural to avoid "you" in the way that technical writers like to.This pattern is quite frequent in Jonathan's posts. I trained myself to skip the last sentence of each paragraph and often the last paragraph entirely. Andrei
Jan 14 2012
On Sat, Jan 14, 2012 at 21:14, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:This pattern is quite frequent in Jonathan's posts. I trained myself to skip the last sentence of each paragraph and often the last paragraph entirely.:) I do the same.
Jan 14 2012
On 01/14/2012 09:14 PM, Andrei Alexandrescu wrote:Since we're on this topic I can't stop picking - all in good fun I hope - on Jonathan, the master of words. The following two sentences convey the same exact information: 1.In longer posts, I think the information is often laid out in an approximately palindromic way.There are certainly times when reducing how much "you" is used reduces the amount of text at no extra cost, but there are other times, when it's far more natural to use "you," and it can become harder to produce sentences without completely reworking that section of text if "you" is removed.2.Sure, it can reduce the word count, but I really don't think that it does all that much to improve the quality of the text, and it can require quite a bit more work, since it tends to be unnatural to avoid "you" in the way that technical writers like to.This pattern is quite frequent in Jonathan's posts. I trained myself to skip the last sentence of each paragraph and often the last paragraph entirely. Andrei
Jan 14 2012
On 1/14/2012 1:09 PM, Timon Gehr wrote:In longer posts, I think the information is often laid out in an approximately palindromic way.We're not in Notlob, you know.
Jan 14 2012
On 01/14/2012 12:14 PM, Andrei Alexandrescu wrote:Since we're on this topic I can't stop picking - all in good fun I hope - on Jonathan, the master of words. The following two sentences convey the same exact information: 1.I've always wanted to say the same but I couldn't be sure that I wouldn't be offensive. Now, hiding behind Andrei: +1 :) AliThere are certainly times when reducing how much "you" is used reduces the amount of text at no extra cost, but there are other times, when it's far more natural to use "you," and it can become harder to produce sentences without completely reworking that section of text if "you" is removed.2.Sure, it can reduce the word count, but I really don't think that it does all that much to improve the quality of the text, and it can require quite a bit more work, since it tends to be unnatural to avoid "you" in the way that technical writers like to.This pattern is quite frequent in Jonathan's posts. I trained myself to skip the last sentence of each paragraph and often the last paragraph entirely. Andrei
Jan 14 2012
On 1/14/12 12:26 PM, Walter Bright wrote:On 1/14/2012 12:36 AM, Jonathan M Davis wrote:"You" can convey a conversational, intimate tone that can be helpful. Together with "I" for the author and "we" as the author plus the reader, "you" can create quite a good frame. That being said, I agree - "you" is a license that should be at best used sparingly, as is "I". AndreiI confess that it's a bit of a pet peeve of mine when people insist on avoiding words like you and your. I completely disagree that it's a problem. And there are times where avoiding it can cause problems and make the text more awkward (though it is true that you can often avoid it fairly easily if you really want to).(though it is true that it can be avoided fairly easily) Fixed that for you. What advantage does the "you" version have, besides upping the word count?But I know that there are plenty of technical writers who would agree with you.I cannot recall any professional technical book that used "you" (yes, I'm sure you can find an example!). It's like wearing jeans to a wedding.
Jan 14 2012
Le 14/01/2012 19:26, Walter Bright a écrit :On 1/14/2012 12:36 AM, Jonathan M Davis wrote:« The linker will fluently and baroquely remind you of that in its native language, encrypted klingon » Copied verbatim from a certain book I'm sure you know about ;) But I have too agrre, some you is good, too much of it isn't in a technical paper.I confess that it's a bit of a pet peeve of mine when people insist on avoiding words like you and your. I completely disagree that it's a problem. And there are times where avoiding it can cause problems and make the text more awkward (though it is true that you can often avoid it fairly easily if you really want to).(though it is true that it can be avoided fairly easily) Fixed that for you. What advantage does the "you" version have, besides upping the word count?But I know that there are plenty of technical writers who would agree with you.I cannot recall any professional technical book that used "you" (yes, I'm sure you can find an example!). It's like wearing jeans to a wedding.
Feb 08 2012
On Sat, Jan 14, 2012 at 09:16, Walter Bright <newshound2 digitalmars.com> wrote:On 1/13/2012 1:20 PM, Philippe Sigaud wrote:Thanks. LaTeX work, mostly. At one time, I asked Andrei for the latex formatting functions used in TDPL, but he was authorized to distribute it. That would permit D docs to get TDPL look & feel.This also extend to anyone who would want to share some template love/lore with the rest of us.I see you've already done a great deal of work on this, it looks nice!I strongly encourage you to continue with it, and release it as a book. We could sure use another book on D!Uh, I don't think it'll ever be a book. I didn't write it with a book in mind.I strongly suggest making the formatting work for a Kindle edition of your book. PDF files do badly on e-readers.What I want (maybe in 1-2 months) is to write a simple D script that takes the .tex files and transform them into simple marked-up text, to produce a DDoc file or an HTML one. Is there any tex -> <whatever format ebooks use> or pdf -> ebook converters?Minor stylistic nit pet peeve of mine: please remove the word "you" and "your" from the prose. It's nearly always redundant, and the sentences flow better without it. "You" is a filler word, similar to "um", "like", and "basically".I'll look and try. Philippe
Jan 14 2012
On 1/14/2012 3:21 AM, Philippe Sigaud wrote:It looks like a book, and I see no reason why it can't be. It'll see far wider distribution as a book.I strongly encourage you to continue with it, and release it as a book. We could sure use another book on D!Uh, I don't think it'll ever be a book. I didn't write it with a book in mind.Kindle ebooks can be automatically generated from HTML text with the kindlegen.exe program downloadable from Amazon. I have the D specification automatically "kindle-izable" in the makefile for dlang.org. The main issue is the short line length, which negatively impacts examples and tables. Another issue is Kindle is black & white, so while the colored text does make it better, it should still be usable if rendered in black & white (which should be done anyway, as many people are color blind).I strongly suggest making the formatting work for a Kindle edition of your book. PDF files do badly on e-readers.What I want (maybe in 1-2 months) is to write a simple D script that takes the .tex files and transform them into simple marked-up text, to produce a DDoc file or an HTML one.
Jan 14 2012
Le 14/01/2012 19:36, Walter Bright a écrit :Another issue is Kindle is black & white, so while the colored text does make it better, it should still be usable if rendered in black & white (which should be done anyway, as many people are color blind).A good practice is to back up coloring with some other tools to convey information, like different font. Conveying information solely by color is a bad practice. You noticed that it doesn't convert well to black and white, you'll also notice that you'll exclude, de facto, color blind people, who are actually frequent (more than most people think).
Feb 08 2012
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. Andrei
Jan 14 2012
On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 1/14/12 5:21 AM, Philippe Sigaud wrote: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!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.
Jan 14 2012
"Philippe Sigaud" <philippe.sigaud gmail.com> wrote in message news:mailman.374.1326575051.16222.digitalmars-d-announce puremagic.com...On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I have plenty of physical books that are shorter than that!On 1/14/12 5:21 AM, Philippe Sigaud wrote: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.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.
Jan 14 2012
On 1/14/12 3:04 PM, Philippe Sigaud wrote:On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Great. With the publishing world undergoing quite some stir, I think it would be very interesting to experience with self-publishing via Kindle. FWIW about 300 - not at all. "Exceptional C++" has 206 pages head to toe and is a great book. In fact 300 is probably a good upper limit in today's short-attention-span world. AndreiOn 1/14/12 5:21 AM, Philippe Sigaud wrote: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!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.
Jan 14 2012
On 01/14/2012 11:04 PM, Philippe Sigaud wrote:On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote: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. :-)On 1/14/12 5:21 AM, Philippe Sigaud wrote: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.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.
Jan 14 2012
On 2012-01-14 22:04, Philippe Sigaud wrote:On Sat, Jan 14, 2012 at 21:07, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Templates is just one part of the language. There are many other parts to write about :) -- /Jacob CarlborgOn 1/14/12 5:21 AM, Philippe Sigaud wrote: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!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.
Jan 15 2012
On Sun, Jan 15, 2012 at 12:16, Jacob Carlborg <doob me.com> wrote:*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...Thank you all for the encouragements!Templates is just one part of the language. There are many other parts to write about :)
Jan 15 2012
On 01/15/2012 05:34 AM, Philippe Sigaud wrote:On Sun, Jan 15, 2012 at 12:16, Jacob Carlborg<doob me.com> wrote:I am hoping that this is good enough for now: http://ddili.org/ders/d.en/ranges.html*snort* I do think a big range tutorial is overdue. Andrei's article is good, but we need something a bit more detailed / for newbiesThank you all for the encouragements!Templates is just one part of the language. There are many other parts to write about :)and shown in the website. Maybe even a .ddoc file with phobos. I wonder if we could provide some Ddoc files like this...Ali
Jan 15 2012
On 1/15/2012 8:00 AM, Ali Çehreli wrote:I am hoping that this is good enough for now: http://ddili.org/ders/d.en/ranges.htmlVery nice, I'll read it more carefully later.
Jan 15 2012
On 1/15/2012 8:00 AM, Ali Çehreli wrote:I am hoping that this is good enough for now: http://ddili.org/ders/d.en/ranges.htmlPlease, can you turn this into a Kindle ebook? Both the Turkish and English versions? http://ddili.org/ders/d.en/index.html
Jan 15 2012
On 01/15/2012 12:18 PM, Walter Bright wrote:On 1/15/2012 8:00 AM, Ali Çehreli wrote:Thank you. Will do! :) AliI am hoping that this is good enough for now: http://ddili.org/ders/d.en/ranges.htmlPlease, can you turn this into a Kindle ebook? Both the Turkish and English versions? http://ddili.org/ders/d.en/index.html
Jan 15 2012
On Sun, Jan 15, 2012 at 17:00, Ali =C3=87ehreli <acehreli yahoo.com> wrote:It sure is! This should be advertised somehow. Maybe add a link in the D Wi= ki? http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial I think many chapters of your book could be linked in there. by the by, I added a Resources appendix, where I cite your chapter on templ= ates. PhilippeI do think a big range tutorial is overdue. Andrei's article is good, but we need something a bit more detailed / for newbiesI am hoping that this is good enough for now: =C2=A0http://ddili.org/ders/d.en/ranges.html
Jan 15 2012
On 1/15/12 4:19 PM, Philippe Sigaud wrote:On Sun, Jan 15, 2012 at 17:00, Ali Çehreli<acehreli yahoo.com> wrote:Should I redditize? AndreiIt sure is! This should be advertised somehow.I do think a big range tutorial is overdue. Andrei's article is good, but we need something a bit more detailed / for newbiesI am hoping that this is good enough for now: http://ddili.org/ders/d.en/ranges.html
Jan 15 2012
On 01/15/2012 04:34 PM, Andrei Alexandrescu wrote:On 1/15/12 4:19 PM, Philippe Sigaud wrote:If that question was for me, of course I wouldn't mind, at all. ;) AliOn Sun, Jan 15, 2012 at 17:00, Ali Çehreli<acehreli yahoo.com> wrote:Should I redditize? AndreiIt sure is! This should be advertised somehow.I do think a big range tutorial is overdue. Andrei's article is good, but we need something a bit more detailed / for newbiesI am hoping that this is good enough for now: http://ddili.org/ders/d.en/ranges.html
Jan 16 2012
On 1/15/2012 5:34 AM, Philippe Sigaud wrote: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.Yeah, we badly need a "The Range Manifesto".
Jan 15 2012
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."
Jan 14 2012
On 1/14/2012 7:05 AM, Jeff Nowakowski wrote:On 01/14/2012 03:16 AM, Walter Bright wrote: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: --------------------- giving you powerful compile-time code generation abilities that’ll make your code cleaner, more flexible and even more ecient. => giving powerful compile-time code generation abilities that’ll make code cleaner, more flexible and even more ecient. ------------------------ its material doesn’t so much teach you how to use templates as show you their syntax and semantics. => its material doesn’t so much teach how to use templates as show their syntax and semantics. ----------------------- the standard ‘building blocks’ you'll use in almost all your templates, => the standard ‘building blocks’ used in almost all templates, ----------------------- and what you can build with them in conjunction with templates. => and what can be built with them in conjunction with templates.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."
Jan 14 2012
Counter-argument: You can't make a pull request to a book. Just take a look at the mountain of errata entries for tdpl.
Jan 14 2012
On 1/14/2012 11:03 AM, Andrej Mitrovic wrote:Counter-argument: You can't make a pull request to a book. Just take a look at the mountain of errata entries for tdpl.Ebooks can be fixed easily. Print books cannot.
Jan 14 2012
"Walter Bright" <newshound2 digitalmars.com> wrote in message news:jesifv$2sm9$1 digitalmars.com...--------------------- giving you powerful compile-time code generation abilities that'll make your code cleaner, more flexible and even more ecient. => giving powerful compile-time code generation abilities that'll make code cleaner, more flexible and even more ecient. ------------------------This particular one, I honestly think the "before" sounds better. But I do agree with...the poster to whom this author is replying to...on the other examples.
Jan 14 2012
On 01/14/2012 08:45 PM, Walter Bright wrote:On 1/14/2012 7:05 AM, Jeff Nowakowski wrote: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.On 01/14/2012 03:16 AM, Walter Bright wrote: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: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."
Jan 14 2012
On 1/14/12 6:54 PM, Georg Wrede wrote:On 01/14/2012 08:45 PM, Walter Bright wrote:He asked for feedback. People sent feedback. AndreiOn 1/14/2012 7:05 AM, Jeff Nowakowski wrote: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.On 01/14/2012 03:16 AM, Walter Bright wrote: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: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."
Jan 14 2012
On Sun, Jan 15, 2012 at 03:27, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 1/14/12 6:54 PM, Georg Wrede wrote:No problemo, Georg. I'm not stressed at all by the grammar / style remarks :) I know that my not being a native English speaker will have me write awkward sentences. I'm glad people are sending me corrections: like Andrei said, I asked for feedback. In fact, I'm thrilled to receive remarks, it means people are interested.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.
Jan 15 2012
On 1/15/2012 5:50 AM, Philippe Sigaud wrote:In fact, I'm thrilled to receive remarks, it means people are interested.Nothing worse than silence! Also, I would be doing you a disservice if you ask for feedback, and I don't because I thought it might hurt your feelings.
Jan 15 2012
On Sunday, 15 January 2012 at 00:54:37 UTC, Georg Wrede wrote: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.Getting feedback on writing style early is a great plus to the author. That way he can incorporate it in future additions and practice it, practice catching it. As for the discussion at hand, I prefer to remove 'you' most of the time. It started with just because I was told to in class, but continues because I've seen what it does to my writing, and I prefer it. But I'm still not perfect with it. Also, yay articles/books on D!
Jan 15 2012
On page 78 where template mixins are discussed, some of the variable names feel rather confusing. I would suggest changing them to be more distinct.
Jan 14 2012
On Sat, Jan 14, 2012 at 14:56, Zachary Lund <admin computerquip.com> wrote:On page 78 where template mixins are discussed, some of the variable names feel rather confusing. I would suggest changing them to be more distinct.OK, added as an issue. You mean all the 'name', 'Named', 'named'?
Jan 14 2012
On Sat, Jan 14, 2012 at 14:56, Zachary Lund <admin computerquip.com> wrote:On page 78 where template mixins are discussed, some of the variable names feel rather confusing. I would suggest changing them to be more distinct.OK, done. Tell me if it's better?
Jan 14 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
Jan 14 2012
On 1/14/12 9:56 AM, Andrei Alexandrescu wrote: [snip] Oh, one more thing. It would be great to make the explanatory boxes either floats, sidebars, or \mbox{}es so they don't span more than one page. Look what happened with "Specializations or static if or Templates Constraints?" on page 21. Andrei
Jan 14 2012
On Sat, Jan 14, 2012 at 17:00, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 1/14/12 9:56 AM, Andrei Alexandrescu wrote: [snip] Oh, one more thing. It would be great to make the explanatory boxes either floats, sidebars, or \mbox{}es so they don't span more than one page. Look what happened with "Specializations or static if or Templates Constraints?" on page 21.I hesitated on this. OK, I'll try, I made it an issue. Do you think code samples should be floats also, so as not to sit on more than on page?
Jan 14 2012
On 1/14/12 10:57 AM, Philippe Sigaud wrote:On Sat, Jan 14, 2012 at 17:00, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Code samples should be able to span multiple pages. Never heard a complaint about it. In contrast, the explanatory boxes are a sort of a unit. AndreiOn 1/14/12 9:56 AM, Andrei Alexandrescu wrote: [snip] Oh, one more thing. It would be great to make the explanatory boxes either floats, sidebars, or \mbox{}es so they don't span more than one page. Look what happened with "Specializations or static if or Templates Constraints?" on page 21.I hesitated on this. OK, I'll try, I made it an issue. Do you think code samples should be floats also, so as not to sit on more than on page?
Jan 14 2012
On Sat, Jan 14, 2012 at 17:00, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 1/14/12 9:56 AM, Andrei Alexandrescu wrote: [snip] Oh, one more thing. It would be great to make the explanatory boxes either floats, sidebars, or \mbox{}es so they don't span more than one page. Look what happened with "Specializations or static if or Templates Constraints?" on page 21.OK, done. I (re)learnt some things about LaTeX spaces, boxes and lengths in the process *shudder*
Jan 14 2012
On Sat, Jan 14, 2012 at 16:56, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 1/13/12 3:20 PM, Philippe Sigaud wrote: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.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.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
Jan 14 2012
On 1/14/12 11:08 AM, Philippe Sigaud wrote:On Sat, Jan 14, 2012 at 16:56, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Emailed.On 1/13/12 3:20 PM, Philippe Sigaud wrote: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?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 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.Yah, I defined several LaTeX environments and a little syntax for that. I also arranged to ignore "..." when it appears alone on a line. Overall it was an effort well worth it.I wondered whether I should present only 'compile-as-shown' examples, which means putting import statements and void main() {/* some code */} everywhere.Define distinct environments for stuff that must be top level vs. stuff that must be wrapped in main or unittest. Andrei
Jan 14 2012
Got it, thanks a lot!Maybe I'll write a small script to extract code samples and compile them. Do you have anything like this for TPDL?Emailed.I'll do the scaffolding.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.Yah, I defined several LaTeX environments and a little syntax for that. I also arranged to ignore "..." when it appears alone on a line. Overall it was an effort well worth it.OK.I wondered whether I should present only 'compile-as-shown' examples, which means putting import statements and void main() {/* some code */} everywhere.Define distinct environments for stuff that must be top level vs. stuff that must be wrapped in main or unittest.
Jan 14 2012
On Sat, Jan 14, 2012 at 16:56, Andrei Alexandrescu <SeeWebsiteForEmail 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++=E2=80=99s templates as they are, they can be a bit dau=nting atfirst." -> "But, based on C++=E2=80=99s templates as they are, D template=s can be abit daunting at first."Done."Well, D=E2=80=99s sane syntax for templates, nifty things like static if=, alias ortuples cured me of that impression." -> "Well, D=E2=80=99s sane syntax fo=r templatesand 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 w=illhelp you, too."Done."Part III presents other metaprogramming tools: string mixins (18), compi=le-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=E2=80=99ll see for example..." -> "...in th=e nextsections (you=E2=80=99ll 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 exampl=esof 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=E2=80=99s both an expression and a declaration, so I=E2=80=99ll call =it a construct." ->"It=E2=80=99s both a statement and a declaration, so I=E2=80=99ll call it=a construct." Infact you can call it a declaration because some declarations may occur wherever a statement is allowed.Done. Thanks for the comments!
Jan 14 2012
https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdfcan'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
Jan 15 2012
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. Regardshttps://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdfcan'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
Jan 15 2012
On Sun, Jan 15, 2012 at 11:50, d coder <dlang.coder gmail.com> wrote: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?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 xSame 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.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
Jan 15 2012
Btw, it's cool you could generate the pdf. Did you have minted and pygments already installed?No. But I downloaded minted.sty and apt-get pygmentize when pdflatex failed.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.Thanks. I have just started reading your tutorial. And I am a slow learner. Regards
Jan 15 2012
"dennis luehring" <dl.soluz gmx.net> wrote in message news:jeu3mf$94o$1 digitalmars.com...Eewww. Do youself a favor and grab a copy of FoxIt Reader. Works just as well, but isn't an insane resource hog. Adobe == bloatware.https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf...with acrobat reader...
Jan 16 2012
On Tue, Jan 17, 2012 at 02:49, Nick Sabalausky <a a.a> wrote:"dennis luehring" <dl.soluz gmx.net> wrote in message news:jeu3mf$94o$1 digitalmars.com...plates.pdfhttps://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtem=st as...with acrobat reader...Eewww. =C2=A0Do youself a favor and grab a copy of FoxIt Reader. Works ju=well, but isn't an insane resource hog. Adobe =3D=3D bloatware.I don't use it normally, but wanted to test the pdf specifically with Reader 10.x, as someone signalled a pb with it. But the pb came only from a mistake I made on github.
Jan 17 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. PhilippeI 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
Jan 15 2012
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
Jan 15 2012
On 2012-01-15 14:33, Philippe Sigaud wrote:On Sun, Jan 15, 2012 at 12:26, Jacob Carlborg<doob me.com> wrote:Sure, go ahead and use whatever you want :)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.Do you have a link?That is, from hasField!(T, "field") to hasField!T("field"). I do not know if for serializing it's interesting or not.It might be, depends on how the implementation look like.Ok, I see. -- /Jacob CarlborgLooking 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
Jan 15 2012
Thanks.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?Sure, go ahead and use whatever you want :)Sure: http://www.semitwist.com/articles/EfficientAndFlexible/SinglePage/#part6-3Btw, 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.Do you have a link?
Jan 15 2012
On 1/15/12, Jacob Carlborg <doob me.com> wrote: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.You mean your `fieldsOf` template? I'm not really sure how that would work, I've tried this: This opBinary(string op)(This rhs) { This res; foreach (field; fieldsOf!This) { mixin("res." ~ field ~ " = this." ~ field ~ op ~ " rhs." ~ field ~ ";"); } return res; } But that gives me errors: Error: variable __aggr901 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Error: variable __key902 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Anyway that Fields mixin was something I wrote as a quick example for the book. I've also tried using traits(allMembers), but that didn't work too good.
Jan 16 2012
On 2012-01-16 12:43, Andrej Mitrovic wrote:On 1/15/12, Jacob Carlborg<doob me.com> wrote:This compiles and run as expected for me using dmd 2.057: http://pastebin.com/fq27831F But I was thinking if the Fields mixin is necessary at all. Since it's possible to get and set the values of structs and objects using tupleof. I was thinking it would be possible to use this technique directly in Notify. Something like this: struct Notify (T) { auto opBinary (string op, T) (T rhs) { T result; foreach (i, dummy ; T.tupleof) mixin("result.tupleof[i] = raw.tupleof[i] " ~ op ~ " rhs.tupleof[i];\n"); return result; } } -- /Jacob CarlborgI'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.You mean your `fieldsOf` template? I'm not really sure how that would work, I've tried this: This opBinary(string op)(This rhs) { This res; foreach (field; fieldsOf!This) { mixin("res." ~ field ~ " = this." ~ field ~ op ~ " rhs." ~ field ~ ";"); } return res; } But that gives me errors: Error: variable __aggr901 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Error: variable __key902 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Error: variable __aggr901 cannot be read at compile time Anyway that Fields mixin was something I wrote as a quick example for the book. I've also tried using traits(allMembers), but that didn't work too good.
Jan 16 2012
Ah, I completely forgot about tupleof. That could work. Originally I've tried __traits() but it didn't work. Thanks.
Jan 16 2012
On 2012-01-16 21:41, Andrej Mitrovic wrote:Ah, I completely forgot about tupleof. That could work. Originally I've tried __traits() but it didn't work. Thanks.No problem. Although tupleof works for private and protected fields as well. Don't know if that would be a problem. -- /Jacob Carlborg
Jan 16 2012