Wednesday, August 22, 2012

D-etractions

I love the potential of the D language, but I have to admit I'm becoming a little disillusioned with the current reality. This is of course, extremely subjective. I don't want to get in a fight with D supporters. I agree it's a great language. To me, most of the issues revolve around a lack of maturity and a small user base. If I was just playing, that wouldn't be a big deal. But for an implementation language for Suneido, I'm looking for something rock solid. Java may be old and boring and "weak", but it's solid.

One of the big issues for me is the lack of tools, especially good IDE support including refactoring. You know this is unlikely to be a priority when the main developers are old school text editor users. (In my mind I can hear them saying "we don't need no stinking IDE") Scala had the same problem until recently, also due to the main developers not using IDE's. But recently they've made IDE support more of a priority. Maybe not so coincidentally, this coincided with the formation of a commercial entity (TypeSafe) promoting Scala. I've done my share of old school editor + command line programming, but to me, a large part of the benefit of statically typed languages is that they allow powerful IDE manipulations.

A similar issue is the meager ecosystem e.g. books, libraries, tools, etc. I look at the libraries and tools I use with Java and few, if any, are available for D.

One thing that makes me a little nervous is D's fairly simple (from what I've seen) garbage collector. When I think about the effort that has gone into the JVM garbage collectors, I wonder how D will compare. D's garbage collector is also conservative in at least some situations (I'm not sure of the details). Based on my experience with conservative garbage collection in cSuneido, this increases my nervousnous.

D's templates and compile time function evaluation, and mixin's also worry me. They are very powerful and very cool, and they might be way better than C++ templates, but they're still complex. Of course, it's the usual story, you judge a new language when you're a newbie, so you don't necessarily have the basis to form a good opinion. But we seldom have the time to become expert before making a decision. I do have a fair amount of experience with C++ templates to judge by. Templates, as in D and C++, are undeniably powerful. Much more so than the generics in Java or C#. But I wonder if they are on the wrong side of the power / complexity balance. And these advanced features appear to be absorbing much of the energy of the development, to the neglect or even detriment of the overall maturity.

I love the potential of explicit "pure" and "immutable". I wish other languages like Java and C# had more of this. But from the meager exposure I've had, the reality is not as nice. I'm sure some of that is simply learning curve. And some of it may be improved by future language improvements. But when you can't put immutable values in a container without wrapping them in a "Rebindable" template, that again makes me nervous.

Of course, you could use a subset of D and try to ignore templates etc. but this is hard psychologically (I got sucked into mixins just to implement lexer tokens!), and also because the libraries make heavy use of templates. Then you'd primarily be consuming templates, not writing them, but you still need some understanding even to use them.

One of my concerns with Suneido implementation is making it easier for other programmers to get involved in the implementation. (i.e. improving the bus factor) In that respect, I think the jSuneido Java code is much better than the cSuneido C++ code (with templates!). And it's probably easier to find Java programmers than C++ programmers, let alone D programmers. (Of course, the challenge of finding good programmers remains.)

I plan to keep an eye on D and hopefully continue to play with it a bit. I wish the project good luck. But for now, I am going to put on hold any ideas of using it to replace cSuneido.

See also: D-tours and System Programming Languages

5 comments:

Anonymous said...

Hi Andrew, No offense! , but at least regarding the IDE/refactoring support you are simply wrong. Alex Bothe has written an outstanding D language plug in for MonoDevelop. The Eclipse (your favorite Tool as far as I know) Plug in for D even shows template generated code.
(Both are going far beyond simple refactoring)

Okay.. BUT saying that D Templates are making you nervous.. ahem.. Then the C++ // C++11 template system should make you panicking!. just want to name constrains. However, I can not resist to forward your blog entry to the D programming language news group, ' cause some of things you are saying here will give some valuable insights and need to be discussed.
thanks for taking the time to evaluate D ,
Bjoern


deadal said...

I have to agree with you here. I'm a D believer, but I'm worried too.

What, according to you, should the D community do to improve on this ?

Manipulator said...

I would like to say that I completly agree with you on the tool support point.
I think D would gain MUCH more traction if it had more easy/newbie friendly tools.

Andrew McKinlay said...

Check out the thread at the dlang forum (thanks to Bjoern for posting the link)

That's great news that the IDE situation is improving. I've used MonoDevelop a bit and it seems good.

Yes, C++ templates, even the old ones, also make me nervous. And as the above thread points out, templates can make refactoring difficult whether automatic or manual.

I'm no expert on how to make D successful. (My own Suneido project has never become very popular.) IDE support is important to me, and I think to others. Personally, I'd like to see more emphasis on "boring" stuff like the garbage collector and less on template "magic".

Anonymous said...

FWIW, There was recently a GSOC project that focused on improving the garbage collector: http://forum.dlang.org/thread/sxbwtucwukcxhhoybuxr@forum.dlang.org

And D's templates are pretty much a done deal at this point. There's some focus on promoting and publicizing them right now (because existing D fans generally feel they kick ass at this point), and they're *used* a lot by D programmers, but I don't see much active development being done *on* them anymore since, like I said, they're a done deal now.