The D Programming Language

Steve Yegge is one of my heroes!

In his latest rant, The Next Big Language, he speaks about his dislike of C++ (exactly as I feel) and what might replace it, the D Programming Language.

Here are some Yeggeish quotes:

C++ does need to get replaced someday. It’s just horrid, and everyone knows it.

D’s a really beautiful language. By rights it should be the next C++. However, C++ programmers won’t have it because it’s garbage collected (even though it can be disabled, and even though Stroustroup himself is now advocating adding garbage collection to C++). Walter Bright is one hell of a lot smarter than the C++ programmers who won’t look at his language, and he has demonstrated that D is as fast as or faster than C++ and nearly as expressive as Ruby or Python. It’s a secret weapon just waiting to be seized by some smart company or open-source project.

But nobody ever accuses programmers of being wise.

Anyway, most of the language research and effort and creativity out there, both in academia and industry, is focused on higher-level languages, so it looks like C++ will continue to struggle happily in its tar pit for some years to come.

C++ is horrid. This is a fact. In my opinion, no one in Mauritius knows C++ perfectly. The language is extremely complex and the various extensions over the years have made it even more cryptic and un-understandable.

According to Steve, D is as powerful as C and C++ yet as expressive (read: easy to program in) as Python or Ruby. If this is true, then D really has the potential to be the Next Big Thing…

I really need to look at D!

(Image courtest of Bit Wise Mag)


  1. “C++ is horrid” yet it is the first language used to teach programming at uom :)

    D is as powerful as C .. is it suitable for system programming?

    According to my Pl classes C is used to program operating systems cause its code are as fast as assembly.

    IS there any chance of seeing an OS coded in D?

  2. (1) This is very unfortunate IMHO.

    (2) Yes. D is a superset of C. And it compiles to native code. So, technically, whatever you do with C can be done with D.

  3. Last I checked, most major applications are still coded in C++. There is a lot of legacy code out there to keep C++ alive for a few more generations. At the same time, the language will keep evolving and possibly surpass whatever else there is. Anyway, if you think about it, what’s the only thing missing from C++? Just garbage collection. And, if talks are conclusive, we might see garbage collection implemented soon.

    Steve is just ranter who’s read too many sci-fi novels: computers that don’t reboot, “Walter Bright is one hell of a lot smarter than the C++ programmers who won’t look at his language”!? WTF is that? Every other language builds on a previous one, as C++ builds on top of C and D builds on top of many others. So, why claim that one language designer is smarter than the other?

    I’ll eat my mouse mat when we start writing applications with D for my employer.

  4. After posting the above, I had another look at D, just to check that it is the same language I read about some time agon. Alas, it is the same one.

    The only thing it is apparently aiming for is to mix different programming styles into one language. For example, it says, it supports points but without the need to use “->”. Frankly, who cares!? Besides, this makes reading the code even more confusing. So, you come across this in.ReadLine() in a D program. Is this a pointer, a reference? How do you tell? Well, you have to scroll 50 lines up to see that it is a pointer after all.

    Just one example of horrendous specification. If D ever succeeds, it will be only because someone has come in to put some more sense into the language.

    Man, people should check what’s on the bandwagon before hopping on.

  5. I’ll eat my mouse mat when we start writing applications with D for my employer.

    I’ll pay to see that :-)

    I guess that this is what:

    * PL/1 programmers said of C around 1975
    * Fortran programmers said of C++ around 1985
    * C++ programmers said of Java around 1995
    * Visual Basic programmers said of C# around 2005

    My point is that new languages emerge regularly to replace old languages. C++ is old. And, according to a lot of extremely bright people, badly designed.

    And, in fact, the only thing that one can be 100% sure of is that C++ will be replaced by something better one day. That is what we call progress.

    It might be by D. Or Javascript. Or Ruby. Or by Steve’s NBL. Or something else for that matter. But C++ will die! Whether you like it or not… ;-)

  6. I think D could possibly be better than C++ , BUT, however nothing can equal or compare to JAVA…grrr lets roll tiger!

  7. Besides “->” makes both reading and writing far more easier.

    [“C++ is horrid. This is a fact. In my opinion, no one in Mauritius knows C++ perfectly. The language is extremely complex and the various extensions over the years have made it even more cryptic and un-understandable.” -avinash]

    Maybe its not well understood by no one in mauritius, ignorance of it doesn’t make it something BAD. Its as if saying, “i don’t know how to drive a ferari, so ferari is a bad car”

    yes garbage collection is what lacks in C++ for the time being.

    “And, in fact, the only thing that one can be 100% sure of is that C++ will be replaced by something better one day. That is what we call progress.”
    C++ will die one day, that’s for sure,but hell it can stay a bit longer (as C still is doing).


  8. According to a lot of people (including myself), C is beautiful. It’s the perfect language if you want to express what a Von Neumann machine is. The Linux kernel is written in C.

    In fact, C has replaced Assembly as the de-facto low-level language.

    C++ on the other hand has no real niche. It is a jack of all trades and master of none. Look, even if, say, Excel is written in C++, this is just an accident of history (i.e. the first version of Excel was written at a time where C++ was the only choice). If M$ has a choice now, I’m 100% sure they’ll write it in C#.

    Most applications now are web-based or multi-tier enterprise apps and they are not written in C++ (most probably, they are written in Java/.NET/PHP etc)

    Even desktop apps are not being written in C++ anymore.

    C++ was a good language in 1995 (after 12 years of existence). It’s not anymore (after 24 years of existence). It’s not because some legacy C++ apps still run that this means that we should rave about C++. C++ is (for me at least) going the way of the dodo. Like COBOL. Like old technologies like CORBA. And I’m extremely happy.

    Bring on Ruby, Squeak and, why not, D!

  9. Now that C has been mentioned, why does Steve stop at C++? Why not criticise C while he’s at it? Surely, everyone knows that C++ is a superset of C, and following the logic, D is better than C++ is better than C. But, no… he needs to bash C++ because, I suspect, he does not master it.

    “C++ has no real niche”? Type definition, for one. All the features of object-oriented programming, for the rest. C++ is powerful, yet simple enough for everyone to use. If you understand the language, you won’t find it complex. The only thing you need to remember is when you create an object, you need to remove it — that’s where garbage collection would come in handy. As for the different libraries you mention, this is not so different from today’s Java and .NET libraries. If you are worried about standardisation, use stdlib.

    Your other points about different languages being useful for different niches are correct. That’s the kind of arguments I was expecting from someone knowledgeable in computer science; not, Steve Yegge says D is the NBL, then it must be so.

    As for no one in Mauritius knowing C++ perfectly, I think you under-estimate your own people. About ten years ago, while we were developing an application in Delphi Object Pascal, I was surprised to see one of the programmers at iConsult (then, IBL’s software division) maintain a C++ application. The UI library had been completely written in-house to provide menu bars, mouse support, etc. That was at a time when wxPython and Qt were not yet known in Mauritius, granted. In any case, no one knows a language completely, except the language designers themselves. C++ is not unsurmountable, however; you just need to get used to it.

    C++ will remain for a very long time to come. Games. The killer app for C++. Why does .NET support C++ if they are so keen to replace it with C# as you claim? Because C# has not reached the same level of maturity as C++ has. But, yes, other more modern languages will replace C++ eventually. Not because C++ design is flawed, but because over the many years that it has been used, programmers have learnt to do things using other techniques. Again: THE DESIGN OF C++ IS NOT FLAWED. IT DID WHAT IT WAS MEANT TO DO, AND VERY WELL AT THAT.

    I am not a hardcore C++ fan; I only use it when I am asked to (as in my previous job where we had to make do with scarce memory). I use whatever gets the job done under the constraints imposed by the business, even if that means using some obscure language as KEVXML or PML. But, I get irritated when something is bashed for no good reason.

    Ruby has a chance. D, not so sure. Squeak, maybe. C#, Java, C++? Absolutely.

  10. @Javed: Java is nice, but there is this thing called C# now. Unless you need portability, I would go with C# for new applications. And, I’m not even a Microsoft groupie.

  11. I dunno about the “->” thing. “.” is easier on the fingers.

    -> = 3 keys. for starters you have to stretch you middle finger out. tiering. then you have to do all sorts of gymnastics to have the last 2 keys pressed simultaneously. Scary maneuver. Don’t try this at home without professional supervision.

    . = contract your right ring finger lightly. An almost natural movement. and gently press 1(one), yes only 1(one!), key. When you’re done, you’ll be like “OMGWTFBBQ!!!!111eleven one1! Did I just do that!?!1/!/?”

    maybe pointers behave differently in D. maybe they are not pointer at all. I haven’t really read about the semantics but even if using the “.” alone might make it difficult to know if there’s a pointer involved, adopting a naming convention would solve the issue:
    ‘p_s’ is a pointer.
    ‘s’ is not.

    MostMany programmers know of C or C++. For some, the language is almost as old as them.
    If you’ve known sea sponge cake all your life and someone comes up with some newfangled chocolate version of your beloved sponge cake, of course you’ll be like “mine is better than yours”
    me and python.
    “indentation!?!? guido, you are an idiot!”
    “wtf? where are my block statements?”
    and that was only the beginning of it. But in the end, python is good stuff. the indentation forces you to write readable code. and and while and indented ‘paragraph’ counts as a block, the lack of delimiters for block statements forces you to try and keep the nesting of blocks to a minimum and keep the lines short. Probably a saner approach…

    I’m guessing that D is fairly new, right? so it can evolve.
    right now there are no libraries other the std one, i think. While C++ has a shitton of em, some doing stuff you’d rather not know of.

    So it would be reasonable to give D a fighting chance.

    well at least it gots block statements… *turns around and punches Guido*

  12. I’m opening (at random) my own copy of “The C++ Programming Language (Special Edition)” by Bjarne Stroustrup:


    int cmp2(const void* p, const void *q)
        return static_cast<const User*>(p)->dept-static_cast<const User*>(q)->dept;


    class AB : public A, public B {
        using A::f;
        using B::f;
        char f(char); // hides A::f(char)
        AB f(AB);


    void f(vector<int>& vi, list</int><int>& li)
        p1 = mismatch(vi.begin(), vi.end(), li.begin(), not2(less<int>())); // not not < means <

    This is supposed to be programming? I bored to death with C++.

    To Eddy:

    Now I understand your point of view.

    You wrote: “As for no one in Mauritius knowing C++ perfectly, I think you under-estimate your own people. About ten years ago, while we were developing an application in Delphi Object Pascal, I was surprised to see one of the programmers at iConsult (then, IBL’s software division) maintain a C++ application.”

    Two observations:

    (1) You are talking about “old” C++ and not the incomprehensible ISO C++ which was normalised 8 years ago. Have you read Stroustrup’s Special Edition? Do you really think that ISO C++ is a good programming language? Have you read Andrei Alexandrescu‘s book? It is supposed to be the definitive book on C++. I have read it and I don’t understand a word. And, mind you, I am not at all stupid. I repeat myself: no one in Mauritius understand the whole of C++.

    (2) You don’t feel Mauritian now?

  13. @Ketwaroo: Glad you can see some humour in all this :-)

    For trained typists, -> does not require such contortions; in fact, going that way would be asking for RSI to strike you down on the spot!

    You are right, maybe pointers don’t behave the same way in D, but the question remains: how do you distinguish one usage from the other?

    My overall feeling about D is that the author thought that it would be nice to be able to do all these things he does in other languages with just one language. So, you see a bit of Python (eg. foreach(argv, argc; args) …), C++ (eg. Person* person = new Person;), and so on. But, man, does the syntax have to be so inconsistent!?

    D tries to solve problems that don’t exist in a not-so-good way, that’s its main fault.

  14. Avinash,

    It’s not so obscure if you understand a minimum of C++.

    P159: Rather than explain it in words, let me explain in the almost-universal Java language.

    int cmp2(Object p, Object q) {
    return ((User)p).dept – ((User)q).dept;

    P393: Ain’t C++ great with its support for multiple inheritance?

    To be honest, I’ve only ever used “using” to access classes and methods under namespaces, but from this code extract, it appears that by using “using” we can access A::f and B::f as members of class AB. The hiding part is out of context, as we don’t know the method signature of A::f(char).

    P523: Again, out of context, so it is not possible to easily identify what this is supposed to do.

    However, all these examples are in the book to describe advanced features of the language, not the kind of thing you’d write in your typical application.

  15. Actually, I have this book on my bookshelf. It’s very verbose. Maybe you were intimidated by the text. I can usually read such dense documentation — I read the whole of C# specifications!

  16. Avinash, I don’t want to get in a heated debate, but I think your views on the C++ language are flawed.

    It makes no sense to claim that anyone fully understands C++. First, it’s specified by an ISO committee. No single person (even in the committee) holds all the knowledge about the language, so it would be ambitious to find an outsider who knows it fully. Secondly, the language itself is simple, but the libraries around it are not; the same holds true for all modern languages that rely on libraries.

    No, I’m not talking about “old” C++. The anecdote I used was to tell that there are surprisingly more people that you would expect who work with C++ in Mauritius. My first encounter with them was about 10 years ago. Since then, I’ve been coding in C++ on and off, including the ISO C++, which admittedly I did not have to know the whole of it. C++, in its core, remains mostly the same.

    As I said, I have Bjourne Stroustrup’s book, but not the special edition. I thought that was the definitive book, as it is very comprehensive. I don’t see the point of having a second book, if I have the one from the original author of C++. But, if I had to learn about the changes in the ISO C++, I’d pick up a book for this.

    1) I am not saying that you are stupid, but I maintain that you are wrong to jump on the Next Big Language bandwagon.

    2) I am still a Mauritian. And, proud of it, too. Maybe you are confused by the use of “your own people” in my response; just to make it clear, that includes me.

    I may be completely wrong here, but I sense that as a long-time student and present lecturer, you have not had the chance to do much programming in a commercial environment. Personally, I have been programming since about 1991 (GW-BASIC on a 8088). I have done so professionally for the past 10 years. During this time, I have deployed exactly eight *new* applications. This may sound few to some, but during your career as a programmer, you do not actually release new applications that often, as most of the time you are maintaining existing ones.

  17. this blog is a busy place.

    @Eddy Young
    The keyboard I’m using right now predates the 286. actually, it was salvaged from a 8088 system. The keys are mounted on hard springs. Anything to reduce digit movements is worth considering.

    about pointers, I’m not a big fan of them but i manage to use them when i need to.
    now D is a new language. emphasis on new. It may stem out from C++ but it’s still supposed to be new. So there are bound to be different things. If the people who developed D come from backgrounds where they use both python. There’ll probably be bit of both in D.
    foreach is useful for looping through arrays. especially if you don’t know much about the array in question.

    Problems may not exist for you. but they may be real for others.

    hehe. It’s kinda tough to be one sided in a discussion eh? At some point you don’t really have any real argument aside from the firm conviction that you are totally in the right.

    I’ll help you a bit:
    @ the funny D Person trying to stuff us C Persons with that silly D thing. Stop it at once. We were here before you. We’ve been trudging hairline deep in C++ doodoo for longer than any of us care to remember and we are very fine with our current situation, thank you very much.

    We do not approve of you trying to give a “powerful” programming language to total novices. We don’t want them in our little club!

    p1 = mismatch(vi.begin(), vi.end(), li.begin(), not2(less())); // not not actually does something. That’s the whole beauty of it..

    Granted C++ is heavy. It need higher intellect to even partially grasp its beauty. It’s said that the majority of students in UoM have poor grades when C or C++ programming is involved. But those who do figure it out will probably have their ego hurt if came along an easier language that would allow more of the less gifted to do what they do without having to toil up the learning curve.

    And at some level, it feels that making things easier lowers the standards. And those who would have been the cream of the crop are relegated to being just the somewhat above average.

    But hey, give D a chance. It’s too early to be talking of major faults.

    @Mr Meetoo.
    actually, no one in the world understand the whole of C++. not just Mauritius.

    ps. on my previous comment, guido refers to Guido van Rossum. I usually have no memory for names but i remember this one for some reason.

    I type too much.

  18. lol. ok. a part of my previous post was cut out

    p1 = mismatch(vi.begin(), vi.end(), li.begin(), not2(less())); // not not < means <

    this line to the neophyte means total gibberish. but if code is poetry, this is one mighty fine verse. Of course you need the whole poem. But it does make sense.
    Gibberish as it seems, it actually does something. That’s the whole beauty of it..

    i really type too much.

  19. To summarise:

    * most people find C++ too complex.
    * some people like C++ though
    * C++ is not a good language for beginners
    * C++ is being replaced by other languages in the business world

    In a way, I find C++ fascinating. I fell in love with it in 1996 and I used it a lot. I wrote a lot of programs in C++. And I used C++ to write part of an application around 1998 which has been bought by Dassault since. I even used C++ at DCDM Consulting.

    When STL was invented by Stepanov and Lee, I also fell in love it that. I remember downloading the documentation for SGI’s website.

    I had the first edition of Stroustrup’s book (in French). I bought the latest edition when C++ was normalised in 1999.

    And then Shock and Horror, I realised that my beautiful C++ has changed into a committee-designed language. I couldn’t understand 50% of Stroustrup book (and as I’ve said, I’m not stupid). Who understands partial template specialisation? What protected inheritance used for? What is a functor? How come it ins’t a closure? etc. etc.

    C++ was fine. But now it’s passé

    Oh well. I guess that, being a researcher at University, I don’t care about 24-years old languages but rather care about new languages which will potentially rule the world in 5 years. This is one of the joys of my current work!

  20. To put a term to the discussion, here’s a summary of my points:

    * C++ still remains a serious contender for application development, now and for many years to come.
    * D is new and has not yet proven itself.
    * Therefore, D groupies cannot [yet] throw dirt at C++.

    * Academic programming is a world apart from commercial programming. Academics marvel at the latest; professionals use what works best.

  21. Just to put a last last term to the discussion (as this is my blog after all)

    * Professionals use what works best


  22. Well, well, if a C++ programmer in 2007 doesn’t understand partial template specialization and functors, that person is obviously not a professional, but rather someone who does programmer to pay the bills.

  23. True.

    But partial template specialisation is required in C++ as it is a statically-typed language. More modern and dynamic languages just use duck typing.

    And it’s the same for functors. They have been introduced in C++ to give the language a Functional feel. But it’s still tough to do higher order programming in C++.

    You’ll agree that C++ is very tough to learn (not to say to teach) properly now as it is so complex.

  24. Anonymous says:

    Well, This is new programming language. D is a natively compiled, statically typed, multiparadigm C-like language. The D accepted library includes bindings to all accepted C functions as well.

Speak Your Mind