Thread overview
Re: An effort at creating a free ebook for learning D
Jun 20, 2011
Kai Meyer
Jun 22, 2011
Ali Çehreli
Jun 22, 2011
Jimmy Cao
Jun 20, 2011
Jimmy Cao
June 20, 2011
On Mon, Jun 20, 2011 at 6:30 PM, Jimmy Cao <jcao219@gmail.com> wrote:
> I helped with something last summer: an attempt at creating a wikibook for
> D.  At that time, my D skills were very bad, so I had to concentrate on
> learning D first before contributing to more lessons.
> One thing that has always bothered me is, there aren't many good *free*
> ebooks for learning D.
> Well, I'll try to continue what I had started less than a year ago.  I'll
> probably make many mistakes while writing, so can you guys check on my
> progress once in a while?
> http://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Lesson_1/Phobos
> What do you think?
> Thanks.

Good idea. Small notes:

*) In the tip section 'write("Hello\n") and writeln("Hello")' are not
the same. writeln and writefln flush. write doesn't.
*) Not sure if you want to also encourage portable code. "\n" should
be replace with newline which I think it is define in std.string.
June 20, 2011
On Mon, Jun 20, 2011 at 4:46 PM, Jose Armando Garcia <jsancio@gmail.com>wrote:

> Good idea. Small notes:
>
> *) In the tip section 'write("Hello\n") and writeln("Hello")' are not
> the same. writeln and writefln flush. write doesn't.
> *) Not sure if you want to also encourage portable code. "\n" should
> be replace with newline which I think it is define in std.string.
>

Thank you for that.

Everyone is welcome to contribute.  (It can be done faster and better that
way)


June 20, 2011
On 06/20/2011 03:46 PM, Jose Armando Garcia wrote:
> On Mon, Jun 20, 2011 at 6:30 PM, Jimmy Cao<jcao219@gmail.com>  wrote:
>> I helped with something last summer: an attempt at creating a wikibook for
>> D.  At that time, my D skills were very bad, so I had to concentrate on
>> learning D first before contributing to more lessons.
>> One thing that has always bothered me is, there aren't many good *free*
>> ebooks for learning D.
>> Well, I'll try to continue what I had started less than a year ago.  I'll
>> probably make many mistakes while writing, so can you guys check on my
>> progress once in a while?
>> http://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Lesson_1/Phobos
>> What do you think?
>> Thanks.
>
> Good idea. Small notes:
>
> *) In the tip section 'write("Hello\n") and writeln("Hello")' are not
> the same. writeln and writefln flush. write doesn't.
> *) Not sure if you want to also encourage portable code. "\n" should
> be replace with newline which I think it is define in std.string.

I wrote some code a while back that was intended to be portable (between windows and linux anyway). I used 'writef("Hello\n");' a lot, and those always printed correctly on windows. Does writef do something different than write with the '\n' character?

-Kai Meyer
June 20, 2011
On Mon, Jun 20, 2011 at 7:13 PM, Kai Meyer <kai@unixlords.com> wrote:
> On 06/20/2011 03:46 PM, Jose Armando Garcia wrote:
>>
>> On Mon, Jun 20, 2011 at 6:30 PM, Jimmy Cao<jcao219@gmail.com>  wrote:
>>>
>>> I helped with something last summer: an attempt at creating a wikibook
>>> for
>>> D.  At that time, my D skills were very bad, so I had to concentrate on
>>> learning D first before contributing to more lessons.
>>> One thing that has always bothered me is, there aren't many good *free*
>>> ebooks for learning D.
>>> Well, I'll try to continue what I had started less than a year ago.  I'll
>>> probably make many mistakes while writing, so can you guys check on my
>>> progress once in a while?
>>>
>>> http://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Lesson_1/Phobos
>>> What do you think?
>>> Thanks.
>>
>> Good idea. Small notes:
>>
>> *) In the tip section 'write("Hello\n") and writeln("Hello")' are not
>> the same. writeln and writefln flush. write doesn't.
>> *) Not sure if you want to also encourage portable code. "\n" should
>> be replace with newline which I think it is define in std.string.
>
> I wrote some code a while back that was intended to be portable (between windows and linux anyway). I used 'writef("Hello\n");' a lot, and those always printed correctly on windows. Does writef do something different than write with the '\n' character?
>
> -Kai Meyer
>

The command line console may deal with it okay but here are many Windows programs that assume that newline is '\r\n'. That is the same problem with '\\' and '/' for path separator. Some tools handle both while others only handle '\\'.

-Jose
June 22, 2011
On Mon, 20 Jun 2011 16:13:37 -0600, Kai Meyer wrote:

> I wrote some code a while back that was intended to be portable (between windows and linux anyway). I used 'writef("Hello\n");' a lot, and those always printed correctly on windows. Does writef do something different than write with the '\n' character?

(I can't see Jose Armando Garcia's answer to this question. For some reason it appears empty in my news reader (Pan 0.133).)

As far as I know, "text mode" file access already translates those characters. '\n' always means "new line" to be replaced with each platform's correct code sequence.

Ali
June 22, 2011
I've done some major restructuring to the ebook.  Now, the link to the first
lesson is:
http://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Phobos/Lesson_1
There are 7 lessons currently.  Lesson 3 (Functions) and 9 (Slicing) are not
written as of now.
If you contribute, please add yourself to:
http://en.wikibooks.org/wiki/D_(The_Programming_Language)/Contributors

Please, do feel free to add content, tips, and code.  There's no errata;
just fix it, that's all.
Anybody know a good idea for a picture to put in the index page:
http://en.wikibooks.org/wiki/D_(The_Programming_Language) ?

Thanks
Jimmy