On Fri, 15 May 2009 22:09:17 +0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
> Steve Teale wrote: >> Andrei Alexandrescu Wrote: >> >>> A chunky fragment of TDPL will hit Rough Cuts soon enough. I'm >>> pondering whether I should be adding exercises to the book. Some books >>> have them, some don't. >>> >>> Pros: As I'm writing, I've come up with some pretty darn cool exercise >>> ideas. >>> >>> Cons: The book gets larger, takes longer to write, and I never solved >>> the exercises in the books I've read, but then I'm just weird. >>> >>> What do you think? >>> >>> >>> Thanks, >>> >>> Andrei >> Andrei, >> Do you have a publisher yet? They will probably give you quite a >> definitive answer. They usually have quite strong ideas about the >> market they are aiming for. > > The publisher, Addison-Wesley, is leaving such details to me. > >> If is is to be a university text book, then Yes! >> I realize that doing it is a pain in the ass. You have to test every >> little thing to the limit, which takes forever. But if you do it you >> will sort out bugs in the book. >> Don't envy you, especially given the moving target of D2 ;=) >> But the best of luck. > > Thanks! One nice thing is I've written (in D!) a little script that > extracts the code from all of my examples, compiles it, and runs it > comparing the output with the expected output. The book will definitely > have a number of faults, but code that doesn't work will not be one of > them. > > It's amazing how much I need to rewrite in wake of recent improvements > to D and Phobos. My initial draft of Chapter 1 used char[] for strings! > I think D couldn't have claimed being much more than a step forward from > C if it stayed with that approach to strings. There's still stuff that > doesn't compile (Walter is working on that), and looking forward I'm so > excited about the forgotten __traits(allMembers) and the reflection > capabilities it begets, I can't stand myself. > > > Andrei Will you mention __traits as a "__traits" keyword, or it will be renamed (or, better, the whole feature re-implemented) to something better-looking one, by the time TDPL is ready? I really hope it will be fixed in one way or another soon. We need a better compile-time introspection and I assume __traits is just a starting point. It is too hack-ish and there is definitely a room for improvement.