D – The Little Language that Could

(So, in reality, D probably isn’t all that little, but here’s to it making it up the mountain.)

A good while ago I wrote a post about my hope for the D programming language as an up-and-comer in systems and embedded programming. D promises to bring a number of modern language concepts and constructs to low-level systems while yet producing a fairly efficient runtime. It’s 3 years on since my original post, but I’m still hopeful.

Just a few days ago a comment came in on my original post. My friend Mark VanderVoord responded in that comment thread. I thought I’d make the content of the thread a bit more visible (below) as it’s concerned with using D in the real world.

There’s been respectable progress toward D becoming viable in the mainstream. I’ll venture a guess that it’s going to be several more years until it truly is.

Update (7/1/2010): We don’t often attract a great many comments on our posts. But we have here. I point it out because there’s good resources, background, and perspective on D in the comments. Take a read. The original comment thread that sparked this post can still be found beneath this update.

Since our comments can’t contain links, I’m listing & linkifying here what our commenters have referenced:

  1. Steve Klabnik pointed out a new kernel project written in D (Steve is one of the authors)
  2. Kevin Bowling recommends the book The D Programming Language written by another of our commenters Andrei Alexandrescu
  3. Several have compared/contrasted D to the new Go programming language by Google

Update (7/6/2010): Commenter devdanke suggested Apple as a D corporate backer. Google seems to be pursuing Go; why not Apple getting behind D? Apple certainly has a lot invested in LLVM of late. Apple may just be up to something—though I’m doubtful it’s D. Time will tell…

slide Says:
June 25th, 2010 at 07:35 PM

Is there any active development that you know of to get D running on embedded, bare-metal type platforms?

Mark Says:
June 25th, 2010 at 11:01 PM

slide:

This is the current state of things as far as I know:

The official D versions (D1 and D2) by Digital Mars (DMD) are only x86 so far

GDC – this is a D front-end with a gcc backend. Theoretically this means you can target anything gcc can (which is almost everything). The work I’ve done with it (mostly ARM) has been pretty tricky to get working, though.

LDC – this is a D front-end to LLVM. Again, this means you should be able to target anything LLVM can. LLVM has a lot of momentum lately… and this port seems to be pretty active too. I have done some small experiments with getting it to target an ARM9. It seemed to work well. I hope to have more time to work on that in the future.

For either LDC or GDC, you’re getting D version 1, which is missing some of the new (in-progress) features. But, they’re more stable, so that’s nice.

D links easily to C, so bringing in libraries, RTOS’s etc is pretty easy.

I hope this helps.

Mark

Conversation
  • It’s great to see D get some recognition as a systems language. I’m a little biased, though, as my friends and I are writing a kernel in D! http://xomb.org/

  • kl says:

    Text with broken encoding is annoying to read: â € ™

  • eris says:

    D is an amazingly powerful OO language. It combines the elegance of modern language constructs (such as iterators, garbage collection and a host of others too long to mention) with the familiarity of of c-style syntax.

    It also doesn’t force you to use the “new” constructs. If you are writing an operating system and you don’t want or need garbage collection you don’t have to use it. If you need a highly specialized garbage collector for your environment, you are free to substitute your own.

    It’s a language made for engineers and computer scientists, not for those who need to be protected from themselves.

    D and C# evolved at roughly the same time, but D doesn’t have major corporate backing. In some ways it’s in the same part of it’s evolution as C was back in, say, 1982.

    D compiles to machine code. It doesn’t try to protect you from “dangerous” things. It takes the tack that so-callled “dangerous” things are possibly interesting and almost always required when created serious to-the-metal software.

    I’ve programmed in D when I wasn’t required to program in something else for a job. The best thing for D right now would be for Walter Bright (the author of D) to lock down the language spec at 1.5 or something. Nail it, submit it for standards approval and get help from Google to promote and fund it.

    For the lack of proper promotion, D is languishing to point where Google is re-inventing D as “Go” — even when D is highly favored as a next generation compiled language within Google.

    The rest of the D community needs to stop arguing the artificial dialectics between implementation libraries, which new esoteric features need to be implemented and the proper implementation of const and invariant.

    I haven’t found a better systems development language. All the tools are there for you, even if they are a little dispersed. There’s a D plugin for Eclipse (Descent), an intelligent make utility for it (xfbuild), a excellent compiler infrastructure (ldc on Unix, dmd on Windows).

    Now what is needed is a killer requirement. Either someone like Google requires it for a platform or the demand for its unique capabilities explodes.

    I do know one thing. Web development isn’t everything. Some highly critical code is written at the systems level and right now all we have is C++, C and assembler.

    C++ is a huge arcane mess.
    Assembler is non-portable.
    C, while it has served for a very long time and is still an extremely powerful language is not well suited for the long term.

    Finally?

    Google “Summer of Code” backing would be incredibly beneficial.

    Could one of the Google “fans of D” do a presentation at Google’s headquarters?

  • Kai Backman says:

    I have some years of practical experience with both D and Go (I’m the main author of the 5g ARM compiler for Go). My personal impression is that D is a better C++, Go is a better C.

    @eris: AFAIK Walter has done a presentation of D at Google a number of years back.

  • Pete, you can turn the gc off whenever you want.

  • I’d be glad to give a free presentation at Google if invited.

  • Iain Buclaw says:

    As the maintainer of the GDC package in Debian and Ubuntu, I invite anyone to test it on any of the 15 architectures it has been ported to, and to give feedback on arch-specific bugs.

  • mark says:

    I am mildy sceptical here because I still feel that the golden standard for embedded is C or C++.

    D would have to provide features in the long run which would really make people want to use it – both as a system language, and for embedded systems.

  • Andrei Alexandrescu’s “The D Programming Language” ought to do a lot to add credibility to the language. It shores up one of the weak points by adding a de facto text.

    At this point, the compiler landscape seems to be the only other weakness. DigitalMars is pretty silly for trying to monetize their compiler at this point. They need to get prolific use of the language first. LDC is the most compelling effort in the compiler space, so hopefully they are able to implement D2 sufficiently sooner rather than later.

  • BioTronic says:

    Keving Bowling:
    DigitalMars does not try to monetize their compiler. It is available for free, the source code is available for free, the only thing somewhat locked down is the back-end source.

  • @mark: which kind of features should D provide “in the long run”? I am asking, because IMHO D is *already* packed of impressive features that make me and a lot of other people want to use it as a system and embedded language.. from blazing compilation (and linking) speed, obtained by carefully engineering the syntax and therefore the parser, to extern “C” linkage compatibility, to compile-time optimizations and wizardry you can actually use and understand – C++ templates are like cuneiform sumerian compared to D templates. I am an experienced C++ programmer, but anytime I can use D for something, I do use it. Highly Recommended :) :)

  • devdanke says:

    I’d just like to reemphasize a point by an earlier commentor Kai Backman.

    I used to think Go was a direct competitor to D, i.e. had the same design goals. But as Kai points out, a closer look at both languages shows that Go is not trying to be a full fledged OO language. It’s focused on being a better C.

  • devdanke says:

    It’s disappointing that D hasn’t had more of an impact yet. D needs a corporate backer. Although some mention Google, I believe Apple might be better.

    Apple is stuck in Objective-C land, which is a very old, tedious, and odd language to work with. D could be just the kind of language Apple needs to draw in more developers for it’s platforms.

    Apple’s involvement could help solve two of D’s biggest problems: D’s dualing runtime library confusion and D’s lack of marketing and buzz.

    Certainly, Apple would help D standardize on a nice runtime library, good for both systems level and GUI programming.

    As for buzz, who could give D more than Apple’s marketing gurus. It’s a match made in heaven!

  • Pete says:

    Parts of the language look very useful, but doesn’t it require the use of dynamic memory allocation for creating objects? And the wikipedia article states that it also has garbage collection…

    Those features are major drawbacks for very low-level and especially safety critical work (as are exceptions). Just look at Ada — huge runtimes that were rarely used and had to be slimmed down to become useful. Many still use it with the runtime turned off (is this possible in D?)

  • I just found out about this language and it looks PERFECT. I’ve been doing C++ for years, and when I read the description of D, I kept saying “YES” to myself at each bullet point.

    I already download the compiler and I’m immediately switching all my new development to this language. I wish I knew about this 2 years ago.

  • Comments are closed.