Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is D2 language ready for production? [closed]

Tags:

d

I've been eagerly learning D language these last days. It looks like a dream for me as a supporter of several millions lines of C++ code. We support heavy performance low latency system and it is clear that C++ was the only option in the last ten years. Now, I see D.

So, my questions are pretty obvious. Can I start thinking about migration commercial software product to D language? Is there any example of such migration or existing big commercial software product written on D from the scratch?

How is it safe to invest in this language now? Do we have production quality compiler and debugger? Can we assume that they will be supported and developed?

If you have any experience in migration from C++ to D, it would be great to hear about it from you.

PS. By D I mean D2

Thank you

like image 288
Stas Avatar asked Jun 18 '11 12:06

Stas


1 Answers

I wouldn't consider D2 to be production ready yet, but it's getting close. The language definition is fairly stable. Very few breaking changes should be happening at this point (though some additive changes intended to iron out key issues in the language may occur). Development on the compiler is moving forward very quickly, and a lot of bugs are getting fixed. But at this point, if you use D2 heavily, you will run into compiler bugs, particularly if you use newer language features. And not all of those features have been fully implemented yet (e.g. alias this and inout), so while TDPL is mostly correct, dmd is still somewhat behind it.

Also, while the standard library, Phobos, is very good overall and much of it is stable, it's still very much a work in progress. We're trying to avoid causing immediate breaking changes by putting stuff that we're removing through the proper deprecation path (generally 6 months as scheduled for deprecation and 6 months as deprecated before complete removal), but sometimes immediate breaking changes do occur (and sometimes the compiler causes breaking changes as it's worked on). In some cases, entire modules are going to be overhauled (e.g. std.xml and std.stream). Possibly the biggest annoyance in that regard is std.container, which is fairly new, doesn't have a whole lot in it yet, and could have a significant redesign as Andrei Alexandrescu sorts out how we're going to deal with memory management in it. So, container support is improving but generally lacking. All in all, a lot of Phobos is fairly stable, but it's definitely not set in stone.

There is definitely support for both dmd and Phobos in that if you post things to bugzilla or discuss them on the newsgroup, people will generally be quite helpful and devs will try and fix bugs in a timely manner, but most of the people working on it do so in their free time, so sometimes it can take a while. The switch to github has definitely improved matters though. I know that Digital Mars provides additional support for dmc if you pay for it, but I don't know if they'll do the same for dmd. I expect that there's a good chance that they will though (certainly, if they don't now, I would expect them to do so in the future).

As for the quality of the compiler, dmd uses Digital Mars' dmc as its backend, and dmc is the newest incarnation of the first C++ compiler to compile code natively (as opposed to translating it to C first), and Walter Bright, the creator of D, has been working on it ever since he created it. He's one of the best compiler writers out there and has created a number of optimizations which have become standard in C++ compilers (such as Return Value Optimization), but dmc doesn't have a lot of people working on it, and there are some areas in which it has fallen behind (such as floating point optimizations), and D is new enough that there's a lot of work to be done in optimizing it. As the bugs are fixed, I'm sure that more focus will eventually shift towards optimizing the language, and it will eventually be on par with C++ in most circumstances (and better in some), but right now it really depends on your code. Sometimes D is on par; sometimes it isn't.

Some people do use D2 in production code (in particular, I know that Adam D. Ruppe uses it for web development with the companies that he works with - he's a frequent poster on the D newsgroup), but I don't think that there are very many of them, and they generally avoid the newer, fancier features of the language (which is generally where the worst bugs are). How stable it's going to be is really going to depend on what you do with the language.

The wiki has some good information on the work remaining to be done, and this recent thread on the newsgroup has some good info as well.

D is definitely approaching the point where I would consider it production ready, but there's definitely some risk at this point. It's great for hobby stuff, but if your livelihood depends on it, I don't know if the risk is worth it quite yet. It's getting close though. It's probably worth your time to look into it, try it out, experiment with it, etc. But I wouldn't just dive in with your production code and convert it all to D. It might work out great, but it might not. I expect that a year from now, I'll be able to say that D2 is production ready, but I don't know how much sooner than that I'll feel comfortable in saying so.

like image 162
Jonathan M Davis Avatar answered Sep 25 '22 12:09

Jonathan M Davis