Code example on www.d-programming-language.org?

bearophile bearophileHUGS at lycos.com
Mon Apr 4 14:02:09 PDT 2011


Andrei:

> We have a rather aged code example on www.d-programming-language.org. 
> What would you think would be a good replacement? The ideal snippet 
> would make a compelling tour of the language's and stdlib's most 
> important features while at the same time being simple and concise.

If you try to cram most features in a simple small program you end with something that looks like a little Christmas tree. I don't think this is a good advertisement for D.

On the rosettacode.org site there are many ways to implement the D solutions. The C solutions are often not much general, and too much low level. The C++ solutions are often over-engineered, over-generalized, and sometimes not easy to understand. The Go solutions are sometimes too much simple. A good D solution is quite short and to the point, simple, at the level required to solve the task, not too much slow, not too much optimized, very easy to read, easy to understand, not too much specific but not even too much generalized. Sometimes solutions in other languages are tagged as derived from the Python and D solutions, this means the D code was readable enough, this is how very publicly visible D code has to be. Readability first, generality but not too much of it, low level when necessary, high level when possible. It's a matter of style. People run away from C++ because sometimes it has an image of a messy and over-engineered language. I suggest to avoid this trap in D code that everyone sees.

Bye,
bearophile


More information about the Digitalmars-d mailing list