As a frequent user and fan of the D programming language, I've noticed a number of misunderstandings and stumbling blocks that frequently trip up newcomers to the D scene.
These are perfectly understandable confusions. Many of them have very legitimate historical causes, so it's unsurprising that certain outdated or inaccurate beliefs persist. I take these as areas where the D community could communicate better to the outside programmer community, so allow me to explain:
D has IDEs
There was a time when D didn't have much IDE support beyond syntax highlighting. This is no longer true. If you like fully-featured IDEs, there are three main options, all of them actively supported:
DSource is dwindling, but D is more active than ever
Every few months, the D community hears something like this: "Is D dead? I went on DSource and everything looked old and unmaintained, the forums seemed inactive, so I assumed D was dying."
DSource was the de-facto project-hosting site for D projects. Note: Was. These days, most of the active projects have moved over to GitHub and BitBucket. In fact, even the repositories for the official D compiler and it's standard library have been hosted on GitHub for well over a year. And in that time, contributions and growth have significantly accelerated, not declined.
There had been updates in the works for DSource to address the issue of easily finding the active projects amongst the dead ones (keep in mind, any free open-source project hosting site is inevitably bound to accumulate many dead projects). But with the incredible recent popularity of GitHub and BitBucket, such an update to DSource would be of minimal value.
It does, however, bother me a bit to say such things about DSource. I've always greatly appreciated DSource, and it was a fantastic thing to have back in the D1 days before GitHub and BitBucket had become everyday names for almost any open-source programmer. The site, bandwidth and hosting were, and still are, very graciously donated to the D community free-of-charge, so I hate to speak of DSource in a manner that sounds like a eulogy. But nonetheless, even though DSource usage is now minimal, D is not only very much alive, it's rapidly growing.
As for finding active D projects, in addition to ordinary search engines, I recommend the D Wiki. Admittedly, we haven't been as good about maintaining the wiki's list of projects as we should have been, but I hereby pledge from now on to do my part, and I'll nag other D users to do the same ;)
UPDATE 2012-12-12: In order to aid and encourage updating, D's wiki has recently moved from http://www.prowiki.org/wiki4d/wiki.cgi to http://wiki.dlang.org, and is now built upon MediaWiki (the same engine used by Wikipedia) instead of the dwindling ProWiki which a number of contributers have found awkward to use. The D community has also taken this opportunity to purge the outdated cruft from the wiki and update it. So D's wiki is indeed progressing!
The D1/D2 split is no more
D2 is where it's at. D2 has already become the stable branch, D1 is a relic. Forget D1, stick a fork in it, it's dead.
And when I say "dead", I don't mean Python 2 "dead": I mean that practically nobody is using D1 anymore. Everyone's already on D2, even the stragglers. D1 is so unused that official support will end at the close of this year, 2012 (and that was announced a year ago). Nobody cares about D1, nobody uses it. It's over.
So, there is no D1/D2 split. There is only D2.
(EDIT: I may have overstated this point. See the comments below.)
Phobos is D's standard lib, but what's up with Tango?
You may have heard about a "Phobos vs Tango" split. In retrospect, that was indeed a misstep for D, but the issue was recognized and fixed. First the summary: Phobos is D's standard lib, period. Tango is now an optional but Phobos-compatible third party library. That's all there is to it.
But that wasn't always the case. Here's the history, for anyone interested:
Back in the early D1-days, back even before Andrei Alexandrescu had come on board, D's standard library "Phobos" was in a very rough, incomplete state. This was because it was being developed entirely by one person (D's creator, Walter Bright). Unfortunately, he was too busy developing the language and compiler to be able to fully flesh-out the standard library (which was, due to various reasons, not entirely open at the time).
So a group of highly talented developers got together and undertook the admirable task of creating a complete standard library. This was called Tango, and it was so good, and so much better than the incomplete (at the time) Phobos, that it became the de-facto standard library.
Unfortunately, in order to work well, Tango needed to replace some of the very-low-level runtime portions of Phobos. This meant Phobos and Tango were incompatible - you had to choose between one or the other, not both. This, quite understandably, became a giant PR disaster.
Meanwhile, Phobos began transitioning to open-source, Andrei Alexandrescu joined up and became Phobos's leader, and Phobos finally started getting fixed and fleshed-out. And it was getting very good in its own right. But this naturally didn't help the "Phobos vs Tango" issue. Admittedly, it may have been a misstep in D's history. But fortunately, the D community heard the "Two standard libs?!?" complaints loud and clear, and set out to fix it.
At this point, D2 was underway as the main "unstable" (at the time) development branch (while D1 had become the stable "non-breaking-changes-only" branch). So for D2, the low-level runtime stuff that was creating incompatibility between Phobos and Tango was factored out and dubbed Druntime. In D2, Phobos and Tango *both* use Druntime, so Phobos and Tango are now fully compatible. There is no more split.
Which should you use? Phobos, unless you have some specific reason to pull in Tango as well. After all, Phobos is the standard library.
Why might you want to use Tango? Same reasons as any other third-party library: If you like the design of it, for example. Tango's design has a very Java-flavor, so Java users may like it. Or if you find something in Tango that's not in Phobos. For example, Tango has the world's fastest XML parser. Phobos's XML library, on the other hand, is the one module in Phobos that's known to still be in desperate need of a rewrite and might get removed. (Don't worry, the rest of Phobos is fantastic.)
D is open source
There are three main D compilers:
- DMD: Official reference compiler
- GDC: Uses GCC and is in the process of being merged into GCC mainline.
- LDC: Uses LLVM.
GDC and LDC are fully open-source, period, and are even in certain Linux package repositories, and not in the non-free sections.
The standard library and runtime, Phobos and Druntime, are OSI-approved Boost-licensed.
DMD's entire source (as well as the standard library and runtime) is publicly available on GitHub. The front-end, which is shared with GDC and LDC is OSI-approved Artistic-licensed (EDIT: It's also dual-licensed under GPL).
The only thing that isn't strictly OSS is the backend of DMD, because the rights are licensed from Symantec. But the source for it is publicly available on GitHub and open for pull requests. Worried about redistribution? Don't be: Just ask Walter. He may be under obligation to require his permission, but it's only a technicality. Ask him, and he'll grant permission. He hasn't been known not to. And note, that's only for DMD, and specifically DMD's backend. Everything else is fully-OSS including two complete D compilers: GDC and LDC.
D is open-source. It wasn't always, but it definitely is now.
D allows manual memory management
D may have a garbage collector as standard, but that doesn't mean you can't control it, stub it or replace it or use manual memory management.
D supports pointers (neatly limited to a memory-safe subset of operations if you're using @safe mode) and calling C functions. So you can call malloc/free, and stick anything you want in the resulting memory using the emplace functions. Or you can use stack-allocated auto-scoped classes. Or reference counting. Or no-clutter RAII. Additionally, there's a whole custom-allocator system in the works.
Static-typed does NOT mean unproductive
D may be static-typed, but that shouldn't make you think "C++ and Java":
% cat funWithRanges.d
import std.algorithm;
import std.range;
import std.stdio;
void main()
{
auto squares = sequence!((a,n) => n^^2)(0);
auto fibonacci = recurrence!((a,n) => a[n-1] + a[n-2])(1, 1);
auto fibEven = fibonacci.filter!(x => x%2 == 0)();
foreach(v; zip(squares, fibonacci, fibEven).take(6))
writeln(v[0], "\t", v[1], "\t", v[2]);
}
% rdmd funWithRanges.d
0 1 2
1 1 8
4 2 34
9 3 144
16 5 610
25 8 2584
And it's not just clean and fast, it's also safe and correct.
Plus there's
some
nifty
concurrent
processing
toys, easy templates and metaprogramming, and the usual lineup of expected modern niceties.
Read more