Few moths ago someone here has implicitaly asked why I like D, now I can 
answer. Feel free to skip this boring wall of text.

I don't like the syntax and rules of C++, to me they look ugly, confusing and 
too much complex, and when I can I avoid this language. It makes me waste too 
much time, and I don't like to learn all its special cases.

I like Python because it's small enough to fit into my limited brain (few parts 
of D seem to not fit in my brain well, and I may suggest to improve them to 
make them more intuitive and simpler), because it's designed for the programmer 
and not for the CPU, because it helps me avoid many kinds of bugs, because its 
syntax is clean, readable and easy to remember. It also has tons of std lib and 
third-part modules, that allow me to plot things, process images and sounds, 
create GUIs, and lots of other things.

But for some of my purposes Python is too much slow, and I have not appreciated 
all the tons of solutions used by Python programmers to solve this problem. I 
have even given a big hand to help the development of a Python compiler 
(ShedSkin) but I now think it's a failed experiment. The only solution I like 
to use is Psyco, but often it doesn't lead to fast enough programs.

In some of my programs I need more than just speed: my problem may require lot 
of memory (and even if it's not a lot of memory, compacting the memory usage 
usually leads to better performance), and genrally I just want the freedom of 
managing memory as I like, so I need something like structs, unions, pointets 
and all that "unsafe" stuff. The D GC allocates blocks of memory as powers of 2 
(under a certain size) and I don't like that much, but there's the 
std.c.stdlib.malloc too anyway, for special situations.

Speed coming to being closer to the metal and freedom of memory usage allow me 
to solve problems that you can't solve in a acceptable time with Python. For a 
silly recent example, it has allowed me to compute the next number of this 
sequence, with a program 40 times faster than the original Python one:
http://www.research.att.com/~njas/sequences/A119770
Of course you can wait a day to receive the answer from the Python program, but 
if the problem space gets ten times bigger I can still use the D program...
Beside this one, I can offer several others less silly examples where the speed 
of the D program was essential, or where for example I have used almost 2 GB of 
RAM in an effective way (where using a dynamic language was hopeless), in 
bioinformatics problems, graph-related problems, etc.

Of course I can use Delphi, C, C++ or CommonLisp to write such programs, but I 
have seen that I am much slower in writing C code, compared to D code, even if 
I am using C for much more time. D helps me avoid problems and bugs, and just 
the built-in arrays are a huge time saver, expecially when you want to manage 
2D arrays (so D allows me to write low-level code only where I want, to speed 
up hotspots and not to write all the program in low-level style as C programs 
generally require). Delphi language is much less modern and offers me less nice 
things.

Using my dlibs I need only a short time and almost no pain to translate Python 
code to D, or to write high-level D code in the first place (translating it to 
C/C++ is surely much more painful, even if someone write something as my libs 
for C++), but with D I can also write in a style very close to C, this is 
useful to translate slowly higher level code to actual C programs (so I use D 
as an intermediate language progressively closer to C or even to asm). I can 
also inline asm code, and learn more assembly, more things about the CPU and 
write fast SSE code.

So I like D because it's a multi-level language (vaguely as C++), because it 
helps me avoid lot of bugs I put into C programs, while being still simple 
enough for my limited mind to learn and manage, unlike C++.

I have also appreciatd D because it has given me the chance to re-learn several 
things of computer science and how a low-level language works. There are 
several things I don't know still that are often discussed in this newsgroup, 
so I have more to learn.

Using D sometimes gives me the same fun people receive from solving puzzles: 
the complex things I have used for example to create the Record struct of my 
dlibs (that mimics a little the tuples of Python) has required me about one 
year of work, and it was better than a complex puzzle. Now for example such 
Record support opCmp and hashing, even if they recursively contain vanilla 
structs :-)

Haskell language will surely teach me several other things that D (and other 
languages I know) doesn't know about. But even very common languages like Java 
offer a lot of things to learn that are not much present in the D programming.

D currently has tons of problems and weak spots, first of all the way it is 
developed, and I really hope to see it fix some of such problems, but for my 
purposes it's better than most of the alternatives.

Bye,
bearophile

Reply via email to