Re: arrays and foreach

2012-04-21 Thread Russel Winder
On Sat, 2012-04-21 at 22:14 -0700, Ali Çehreli wrote: [...] > That part is done: > >http://ddili.org/ders/d.en/hello_world.html As you are emphasizing use of dmd, and the initial programs will all be relatively small scripts, I wonder if using rdmd would be a good move. Shortening the edit--c

Re: arrays and foreach

2012-04-21 Thread Russel Winder
On Sun, 2012-04-22 at 06:59 +0100, Russel Winder wrote: > On Sat, 2012-04-21 at 22:14 -0700, Ali Çehreli wrote: > [...] > > That part is done: > > > >http://ddili.org/ders/d.en/hello_world.html > > Surely "Hello World" shows just a few, and definitely not all, of the > essential concepts of a

Re: arrays and foreach

2012-04-21 Thread Russel Winder
On Sat, 2012-04-21 at 22:14 -0700, Ali Çehreli wrote: [...] > That part is done: > >http://ddili.org/ders/d.en/hello_world.html Surely "Hello World" shows just a few, and definitely not all, of the essential concepts of a programming language. -- Russel.

Re: arrays and foreach

2012-04-21 Thread Ali Çehreli
On 04/18/2012 01:26 AM, Somedude wrote: > For a complete beginner, it's very frustrating to have to read 4 > chapters of fluff, then write the program, and still not knowing how to > run the program. Where is the fun ? I can guarantee that at this point, > 9 out of 10 beginners will drop the read

Re: Newbie Introduction (was Re: arrays and foreach)

2012-04-19 Thread Ali Çehreli
On 04/19/2012 10:02 AM, SomeDude wrote: > On Wednesday, 18 April 2012 at 19:43:50 UTC, Paul D. Anderson wrote: >> SomeDude: Your outline and especially your emphasis on what a rank >> beginner needs to know is very good. >> >> Would you consider writing it up yourself? Not the whole thing, maybe >

Re: Newbie Introduction (was Re: arrays and foreach)

2012-04-19 Thread SomeDude
On Wednesday, 18 April 2012 at 19:43:50 UTC, Paul D. Anderson wrote: SomeDude: Your outline and especially your emphasis on what a rank beginner needs to know is very good. Would you consider writing it up yourself? Not the whole thing, maybe but the beginner info and the compiler/linker appen

Newbie Introduction (was Re: arrays and foreach)

2012-04-18 Thread Paul D. Anderson
SomeDude: Your outline and especially your emphasis on what a rank beginner needs to know is very good. Would you consider writing it up yourself? Not the whole thing, maybe but the beginner info and the compiler/linker appendices. You have a commendable prose style. There are tutorials avai

Re: Compiling Was: arrays and foreach

2012-04-18 Thread SomeDude
On Tuesday, 17 April 2012 at 12:11:21 UTC, David wrote: In this case, I had to type: rdmd -unittest --main test.d Without the --main, I would get linker errors, and couldn't find the reason for these errors. Happily, someone here explained me that the effect of the --main flag was to insert a

Re: arrays and foreach

2012-04-18 Thread Ali Çehreli
On 04/18/2012 03:06 AM, Somedude wrote: Le 18/04/2012 10:26, Somedude a écrit : Yes, I think that you have a lot of valuable information, but the organization is lacking. The advanced chapters look good, but the first "beginner" chapters can be . ... largely improved. Thank you, this is all

Re: arrays and foreach

2012-04-18 Thread Somedude
Le 18/04/2012 10:26, Somedude a écrit : > Yes, I think that you have a lot of valuable information, but the > organization is lacking. The advanced chapters look good, but the first > "beginner" chapters can be . > ... largely improved.

Re: arrays and foreach

2012-04-18 Thread Somedude
Le 17/04/2012 16:07, Ali Çehreli a écrit : > On 04/17/2012 12:42 AM, Somedude wrote: > >> Sorry for hijacking this thread, but since you're around, I hope you'll >> see this message. As a D beginner, I'm browsing through your book. >> I wanted to tell you that there is something essential missing

Re: arrays and foreach

2012-04-17 Thread Ali Çehreli
On 04/17/2012 12:42 AM, Somedude wrote: Sorry for hijacking this thread, but since you're around, I hope you'll see this message. As a D beginner, I'm browsing through your book. I wanted to tell you that there is something essential missing in it: how to compile. It's actually quite hard to fin

Re: Compiling Was: arrays and foreach

2012-04-17 Thread David
In this case, I had to type: rdmd -unittest --main test.d Without the --main, I would get linker errors, and couldn't find the reason for these errors. Happily, someone here explained me that the effect of the --main flag was to insert a main() function just for this case. That's not surprising

Re: Compiling Was: arrays and foreach

2012-04-17 Thread Somedude
Le 17/04/2012 12:19, Mike Parker a écrit : > On 4/17/2012 4:42 PM, Somedude wrote: > >>> >>> Ali >>> >>> >> Hi Ali, >> >> Sorry for hijacking this thread, but since you're around, I hope you'll >> see this message. As a D beginner, I'm browsing through your book. >> I wanted to tell you that there

Compiling Was: arrays and foreach

2012-04-17 Thread Mike Parker
On 4/17/2012 4:42 PM, Somedude wrote: Ali Hi Ali, Sorry for hijacking this thread, but since you're around, I hope you'll see this message. As a D beginner, I'm browsing through your book. I wanted to tell you that there is something essential missing in it: how to compile. It's actually qu

Re: arrays and foreach

2012-04-17 Thread Somedude
Le 17/04/2012 02:01, Ali Çehreli a écrit : > On 04/16/2012 04:56 PM, darkstalker wrote: >> i have this example program: >> >> --- >> void main() >> { >> int[3] a; >> foreach (p; a) >> p = 42; >> writeln(a); >> } >> --- >> >> after running it, i expect to get [42, 42, 42] but instead i get [0, 0, >>

Re: arrays and foreach

2012-04-16 Thread darkstalker
On Tuesday, 17 April 2012 at 00:00:57 UTC, Andrej Mitrovic wrote: On 4/17/12, darkstalker wrote: It possible to have 'p' passed by reference? Yes and the answer is in the question: foreach (ref p; a) p = 42; thanks, it works

Re: arrays and foreach

2012-04-16 Thread Ali Çehreli
On 04/16/2012 04:56 PM, darkstalker wrote: i have this example program: --- void main() { int[3] a; foreach (p; a) p = 42; writeln(a); } --- after running it, i expect to get [42, 42, 42] but instead i get [0, 0, 0] (i know that you can do a[] = 42, it's just a trivial example). So it seems tha

Re: arrays and foreach

2012-04-16 Thread Andrej Mitrovic
On 4/17/12, darkstalker wrote: > It possible to have 'p' passed by reference? Yes and the answer is in the question: foreach (ref p; a) p = 42;

arrays and foreach

2012-04-16 Thread darkstalker
i have this example program: --- void main() { int[3] a; foreach (p; a) p = 42; writeln(a); } --- after running it, i expect to get [42, 42, 42] but instead i get [0, 0, 0] (i know that you can do a[] = 42, it's just a trivial example). So it seems that you cannot write int