On Tuesday, 6 May 2014 at 13:12:01 UTC, Adam D. Ruppe wrote:
On Tuesday, 6 May 2014 at 12:40:48 UTC, Szymon Gatner wrote:
Any way to see the TOC?

Hmm, not on the website yet but here it is. Each one is shown through examples (with a few exceptions where I couldn't think of a good example but wanted to discuss the principle behind it anyway):

Chapter 1: "Core Tasks", has a brief introduction to D then gets into using modules, libraries, immutability, classes, basic stuff to get you acquainted with the core language.

BTW the book assumes you already know basic programming stuff, so I don't explain what variables are and stuff like that.

Chapter 2: "Phobos", goes over some phobos modules to show you the basic idea. Covers files and directories, socket clients and servers, zlib, random numbers, and a bit more. It isn't comprehensive, there's the documentation for that, but it covers a few important points you'll need to know throughout through representative examples.

Chapter 3: "Ranges" goes over how to create a range, use a range (including something I had to ask the group: what is a "generic input range"?), transform ranges, and use some of the algorithms. Also goes into why the efficiency rules are important (don't emulate range features you don't really support) by showing a bad sort result with a linked list that pretends to be an array.

Chapter 4: "Integration" talks about how to integrate with outside code, including calling C functions (including doing your own bindings and using implib on Windows), C++ interfaces, Windows API and Linux system calls in asm, C functions calling D, using COM, cross-language resource management (briefly) and I show some convenient scripting bindings using opDispatch with my script.d

Chapter 5: "Resource Management" gives tips on avoiding the GC, writing your own reference counted objects, using owned pointers, and stuff like how not to use class destructors.

Chapter 6: "Wrapped Types" goes into a bunch of struct features you can use to wrap other things. Includes a cute trick to make a gettext translation file in D alone, operator overloading, disabling default construction, etc.

Chapter 7: "Correctness Checking" talks about bug catching. Includes an introduction to ddoc, static assert, throw vs assert, @safe, and more.

Chapter 8: "Reflection" goes into compile time and runtime reflection including TypeInfo, __traits, is(), std.traits, and using module constructors to extend typeinfo. Culminates in an automatic function caller from the command line, showing how to get functions by name, convert strings to their arguments, and their return values back to strings, all generically with CT reflection.

Chapter 9: "Code Generation" talks about user-defined literals (including showing a disassembly to you can prove it did what it was supposed to do), template value parameters, string mixins, domain-specific language converters (including a relatively traditional programming language and an ASCII art diagram conversion to a struct), and talks about doing more efficient generation with the right statements so the optimizer can do its magic.

Chapter 10: "Multitasking" introduces you to threads, fibers, pipe process, and std.parallelism. I don't go too deeply into all this since I think the documentation and Andrei's book both did a good job and I didn't have a lot to add.

(generally, I wanted my book to be a nice complement to Andrei's book and avoid repeating documentation, so it is genuinely something new that you might not have seen before. Though much of it is stuff I've talked about on the forums, stack overflow, or IRC, so it won't be all new if you've seen my posts over the last couple years.)

Chapter 11: "Kernel coding in D" gets you started using D on bare metal x86; booting your PC to a D program without an operating system. Shows how to remove druntime then add back the minimal parts to get hello world to compile, how to easily compile and link the program so it can run without the OS (a simpler process can be used to make a minimal tiny binary that works on an OS btw, it would be like using D as C), then kinda dumps some code on you to get keyboard interrupt handling working.

I didn't go into the details of how the hardware specific code works; I didn't explain what an interrupt table actually is or why its format is so weird, but I did give you the pieces to make it work and discuss the D features that are helpful in this environment (and some pitfalls) like naked asm functions.

Chapter 12: "Web and GUI programming" shows how to get some fun stuff started with my misc github libraries including a dynamic website, a desktop graphics demo, some image file manipulation, an OpenGL window, and my dom.d for HTML parsing and manipulation.

The main focus isn't so much how to use the libraries though, there's the [s]docs[/s] lol, the source and emailing me with questions for that. Instead, I talked more about how I implemented them and some lessons learned in the process so you see more practical application of stuff the book talked about before and can hopefully use that to extend your own libraries.

Each thing also has a See Also section pointing to other D libraries.

Appendix A: has a small assortment of things that didn't fit elsewhere like bare metal ARM getting started, Raspberry Pi coding, getting a stack trace without an exception, the exponent operator, and finally, how to get more help and resources about D.

Holy s**t, that is a lot! How did you manage to fit all this in 337 pages?! I assume it has standard PACKT format ("give it a go hero" etc)? Bought it and waiting for a release :) Congratz!

Reply via email to