Is D more cryptic than C++?

bearophile bearophileHUGS at lycos.com
Wed Nov 30 01:03:27 PST 2011


Abrahm:

D is a bigger and more complex language compared to Java. And D gives more freedom compared to Java, so it's a bit easier to write D2 code that's unreadable compared to Java. But compared to C++ I think D code is a bit less cryptic because some of idioms of good C++ are language constructs in D, so they are more easy to see and (hopefully) better enforced by the language. I've seen both unreadable Python code and well readable Perl5 code so in the end it's a lot a matter of how you use it.


> I get the feeling that it is from reading the threads in here. Is there 
> somewhere that has non-trivial D and C++ code that does the same thing, 
> side by side, so that I can evaluate D better?

I suggest Rosettacode, it contains hundreds of "Tasks", with their translations in many languages, like C++ and D2:
http://rosettacode.org/wiki/Category:C%2B%2B
http://rosettacode.org/wiki/Category:D
There are draft Tasks too:
http://rosettacode.org/wiki/Category:Draft_Programming_Tasks

Few people are working hard to create hundreds of well written D2 implementations of those.

They are tiny programs, so if you look for longer C++ vs D comparisons you will need to look elsewhere.

Bye,
bearophile


More information about the Digitalmars-d mailing list