The State of D in 2015

A large company can push a programming language into the proverbial limelight: just look at C#, Java, and Objective-C and Swift. But a few programming languages can punch above their weight without any help from prominent companies or developers.

While some of these languages achieved early success only to fall by the wayside (e.g., Delphi), one language that has quietly gained popularity is D, which now ranks 35 in the most recent Tiobe Index.

Why D?

Inspired by C++, D is a general-purpose systems and applications language that’s similar to C and C++ in its syntax; it supports procedural, object-oriented, metaprogramming, concurrent and functional programming. D’s syntax is simpler and more readable than C++, mainly because D creator Walter Bright developed several C and C++ compilers and is familiar with the subtleties of both languages. D started development in 1999 and reached Release 1.0 in January 2007, with a newer version of D (D2) appearing in the same year. This is now the official version of D, with the original D now known as D1 and in maintenance.

Click here to find programming jobs.

In some respects D is old school, like C++. It compiles directly to machine code, then gets linked to an exe and runs directly (no virtual machines here). It’s handy for quick-and-dirty programming as well as for large projects. But the similarity with C++ only goes so far: D has modules instead of namespaces, a garbage collector, simpler templates, immutable types and data structures, Lambda functions, and closures (to name but a few). Some other points:

  • The garbage collector means that explicit destructors aren’t needed, which simplifies memory management enormously. Destructors are available and can be used on structs, particularly for resource management. The downside of garbage collection is that care is needed with memory allocation to minimize the time spent collecting; read the Wiki for tips on memory management.
  • Modules let you group functions, types, etc. in one file, which speeds up compilation—it’s much faster at compiling than C++. Classes in the same module have access to each other, rather than the explicitly declared friend functions in C++. A bunch of module source code files in the same directory form a package with the directory name used as the package name. When the compiler finds an import name, it looks in the directory for the module file.
  • There’s a D package registry that currently lists over 400 third-party packages. If you’re looking for D database drivers and the like, this is the place to start. It’s busy as well, with over 20 updates in the first half of January.

Multi Platform

D offers compilers for all three platforms (Windows, Mac and Linux) as well as FreeBSD. Take things down another level, though, and things get a bit complicated: In addition to the official DMD (Digital Mars D) compiler, there’s also GDC, which is front-end for the GCC back-end, as well as LDC, which is a DMD front-end plus an LLVM back-end. All of these compilers are free, although not all are open source.

There’s no official IDE as such, but on Windows there’s the Visual Studio plugin Visual-D, written in D, which includes project management, syntax highlighting and code coverage support. On Linux or Mac there’s DDT, an Eclipse-based IDE.

Upload Your ResumeEmployers want candidates like you. Upload your resume. Show them you’re awesome.

Direct Access to C APIs

In addition to having data types that correspond to C’s types, D provides direct access to C’s APIs, making it a straightforward task to use open-source code such as SDL, OpenAL, Bullet Physics engine and many more.

Conclusion

I like the D language: It’s well thought out and avoids many of the complexities you encounter with modern C++ programming. There are a lot of clever additions such as invariant blocks in functions, type properties, labels on loops and much more.

On the downside, I searched for D programming jobs and found just a couple. The name doesn’t help, as “D” matches too many terms in a typical search. (Perhaps they should call it dlang, similar to how Google began using “Golang” for Go, especially as the D website is dlang.org.)

If you are looking for a solid cross-platform development system, you could do a lot worse than D. It has great potential for game development and I expect it to continue to grow in popularity.

Related Articles

Image: VisualD

Related

7 Responses to “The State of D in 2015”

      • I was a puzzled by this too. It’s quite popular and so far as I know has been increasing in popularity over the past few years. If you add TIOBE’s Delphi and Pascal together (because who uses procedural Pascal these days? All Pascal is Object Pascal) it’s up to number 8 or something.

        It does seem to be a language people love to mock (I don’t know why; objectively it’s a great platform), but such a tone, if that’s how it was meant, is out of place for an article like this. Otherwise it’s just incorrect. I’d be interested in reading an article on the language, actually, if the author feels like writing a similar programming article?

  1. Bruce McGee

    If you put any stock in these kinds of things, Delphi and pascal combined (it just makes sense) have ranked between position 8 and 12 on the Tiobe list for years.

    I don’t have anything against D. I just think the author chose a (really) bad example of a language that’s “fallen by the wayside”.

  2. Antonio Fernandez

    D is a fantastic language. It supports modules, which allow developers to organize their code base better than it is possible in C/C++ without imposing a draconian discipline. Templates and traits help in order to write less code code, and even possibly incurring into fewer bugs. It can really make things easier.