suggestion: D Book Project

Gregor Richards Richards at codu.org
Tue Sep 5 15:17:05 PDT 2006


Derek Parnell wrote:
> On Mon, 04 Sep 2006 02:31:12 -0400, Agent Orange wrote:
> 
>> We should write a book about D, or even a D for C++ programmers book. It 
>> would probably only be a handfull of chapters, and one or a couple 
>> people could do each chapter. maybe even do it on a wiki or something. I 
>> dont know how the styles would mesh but I just thought this would be 
>> pretty cool to have.
> 
> May I refer you to http://en.wikibooks.org/wiki/D_Programming
> 

That book is not arranged like a book.  Nobody could actually learn D 
from it, even if it was fleshed out.  It needs to be scrapped.

I've been considering this, and started to make a very basic TOC.  I may 
continue working on it.  Or not :)

Coding style to be used throughout (note that this is NOT my style, just one
that's fairly easy to grasp and not difficult to read):

int function(nospace, before, function, parameters)
{
     // brace goes on its own line
     if (a) // conditionals have a space before their arguments
     {
         // in both functions and conditions
     }

     while (a.very.long.line.is.being.forced && to.wrap || 
or.look.very.ugly +
            it.will.wrap.at.column - 80)
     {
     }
}

(in this TOC, [something] is used to describe content, not as part of 
the title)


1. Before We Begin...
1.1. Short Introduction to D
1.2. D Compiler
1.2.1. DMD
1.2.2. GDC
1.3. Editors Supporting D
1.3.x. --- TO BE COMPLETED ---

2. The Basics
2.1. Introduction to Modules
2.2. The main Function, or Start at the Beginning
2.3. Basic Output [using std.cstream.dout]
2.4. Basic Input [using std.cstream.din, basic "Hi, I'm D.  What's your 
name?" prog]
2.5. Types [input of a few different types, up to dynamic arrays]

3. Conditions and Loops
3.1. The if Conditional
3.1.1. More Complicated Input [a program that asks age and makes a 
"clever" response]
3.2. The while Loop
3.2.x. --- TO BE COMPLETED ---
3.3. The foreach Loop
3.3.x. --- TO BE COMPLETED ---
3.4. The for Loop
3.4.x. Advanced Uses
3.5. The switch Conditional
3.5.x. --- TO BE COMPLETED ---

4. Functions and Simple Arguments
4.1. The Concept of Functions [NOT in the Functional Programming sense]
4.2. Simple Functions
4.3. Recursion
4.4. Passing Basic Types
4.5. Passing Arrays

5. Basic Classes and Object Orientation
5.1. The Concept of Classes
5.2. Simple Classes [an extension to the input programs above that has a 
"person" class with char[] name, int age, etc]
5.3. Methods
5.4. Data Hiding

6. Advanced Arrays
6.1. Dynamic Arrays, Concatenation and COW
6.2. Static Arrays
6.3. Associative Arrays

7. Modules
7.1. Modules and the Filesystem
7.2. Making your Own Modules
7.3. Importing Modules
7.3.1. Public vs private vs static imports
7.3.2. Namespace and Conflicts

8. Advanced Object Orientation
8.x. Class Inheritance, Interfaces, Operator Overloading, Friendly 
Classes per-module
8.x. --- TO BE COMPLETED ---

x. Exceptions (? top level?)
x.x. --- TO BE COMPLETED ---

x. Templates and Generic Programming
x.x. Basic Templates, Mixins?
x.x. --- TO BE COMPLETED ---
TO BE CONTINUED

In no particular order:
Exceptions
Mixins
Function Pointers and Delegates
Lazy Evaluation
Enumerations
Structs (maybe in chapter 8?)
Properties
Pragmas
Unions
Garbage Collection
Conditional Compilation (version, debug, etc)
Contracts


  - Gregor Richards



More information about the Digitalmars-d mailing list