"Try it now"

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Apr 14 08:15:19 PDT 2011


If you remove asserts then we're forced to run the examples every time
we want to remind ourselves of what the code does. With assert it's
obvious what the code does.

And besides, why discourage newbies from learning about assert?
Looking at examples with write's could make them think it's a standard
way of debugging code. "Just print all the values, and then check them
one by one to see that they're valid". Let them learn about asserts
and unittests.

Another thing is that I believe most newcomers to D are C/C++
programmers. If we show them how easy it is to check code for
validity, they might start thinking that using asserts and unittests
isn't such a bad thing after all. If you ask an average C++ programmer
whether they use asserts and unittests they'll probably say "No,
because it's too difficult to set up and run them, and I'm too lazy".
Heck, every other day someone comes up with a brand new unittest C++
_library_, and people are completely uninterested.

IMO we shouldn't be hiding D's top features just because they might
look foreign at first.


More information about the Digitalmars-d mailing list