Example within documentations of D seriously need some improvement.

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat May 28 06:16:37 PDT 2011


> Proper comment and proper output.
> writeln(1+2); // should print 3, numbers are added.

There's nothing proper about that. I've already fixed a bunch of
examples in the documentation because they had comments explaining the
results instead of using an assert. And the comments were wrong,
because it turns out that some part of the compiler has changed which
makes the output of some call to writeln() different. You can only
catch such cases if they're in an assert.

Every new D programmer should learn about assert. Once they've seen a
couple of examples there will be nothing ambiguous about seeing it in
the documentation again.

And you can't treat readers as if they're going to be newbies forever.


More information about the Digitalmars-d mailing list