On Sun, Aug 9, 2009 at 9:34 AM, Andrei Alexandrescu<[email protected]> wrote: > Jos van Uden wrote: >> >> Andrei Alexandrescu wrote: >>> >>> >>> http://www.reddit.com/r/programming/comments/975ng/diving_into_the_d_programming_language_tdpl/ >>> >>> (Don't tell anyone, but I plan to rewrite it.) >>> >>> Andrei >> >> This doesn't compile: >> >> string[] words = split(strip(line)); >> >> it has to be >> >> string[] words = split(strip(line.idup)); >> >> >> I like the way you write, it's amusing. And most of the time, you explain >> things well. But many of the code examples you provide >> don't compile or don't give correct results (I also had this problem >> with the Dr. Dobbs article). That makes me wonder if you actually test >> them or just write them off the top of your head? > > Apologies for the low quality of code samples. I've recently wrote a script > that extracts all snippets from the book, compiles them and runs them > automatically, and possibly compare output against the expected output. > > Currently not all snippets can compile. Walter and I are working on that. > I'll add the necessary warning in the next TDPL draft. > > Thanks for letting me know about the strip problem.
http://d.puremagic.com/issues/show_bug.cgi?id=3132 It's also arguable that all functions in std.string should take const(char)[]. Or, you know, const(T)[], since D supports encodings other than UTF-8, despite what std.string leads you to believe.
