Fully dynamic d by opDotExp overloading

bearophile bearophileHUGS at lycos.com
Fri Apr 17 12:41:41 PDT 2009


Nick Sabalausky:
> I'd rather have my compiler automatically guarantee 
> correctness (when possible) than have to manually create even more tests 
> than I'm already creating and *hope* that they catch all the problems.

This is a very old discussion about the pro/cons of dynamic/static typing :-)
(Also note that in such discussions what is often missing is a really powerful and flexible static type system, like Haskell one :-) )

Anyway, regarding what you say here, note that writing tests in python can be very fast, for example if you use doctests :-)
http://docs.python.org/library/doctest.html

In Haskell you have other good solutions as QuickCheck that invent tests for you:
http://www.cs.chalmers.se/~rjmh/QuickCheck/

In my D code I write almost as many tests as I write in Python (about 0.8-1.5 lines of tests for 1 line of D code, while in Python I write about 1-2.5 lines of tests for each line of code). The D compiler is able to catch some bugs the PythoVM isn't able to, but such errors are usually easy to find and fix in Python code, and such tests are quick to write.
But then you have to write tests for the logic of method/functions/classes, and they require some time to be written in both languages.
The end result is that writing tests in Python is usually not as bad as you think.

Bye,
bearophile



More information about the Digitalmars-d mailing list