D language

Pages: 123
I was thinking about learning D, but haven't gotten around to it yet.
So I hereby ask anyone who has had hands on experience with it, to share your stories.

Was learning it worth your effort and time?
Do you actually use it for your projects?
Any features you miss from C++?
Any reason why you returned to C++?
Etc.

I recognize the flamewar potential.
But I trust you all to be mature enough to keep this thread objective, educational, nice, and fluffy.

Here goes...
closed account (S6k9GNh0)
D the language is rather awesome. It takes a lot of "attributes" that GCC has and places them into easily readable syntax. It does some really cool things and has great Unicode support. In the next few years, it may become very viable. The language itself is much easier on grammar than C++ is. But...

1. I'd say D is to C++ like Go is to C. Go and D are not very viable SP languages.

2. While you can avoid the garbage collector, that basically means you can't use most of the standard library.

3. The community really has a Java feel to it. They often don't care as much for efficiency as say a C++ programmer would.

4. Somethings are unnecessarily done at runtime when they shouldn't be. For instance, you can link to a C library and use the library functions just fine. However, the community doesn't want you to link to the library, they often want you to unnecessarily add startup overhead and load it dynamically, and they often don't understand the place and need for such a thing. For instance, with a game that *requires* SDL to run, there's no point in dynamically loading it at runtime. However, this is done anyways and it both complicates life and bindings. This isn't the fault of the language.

4. Binary sizes are currently stupid. A simple hello program with DMD is over half a megabyte and with GDC, is nearly 1.4mB. This is mostly because it will not dynamically link to phobos (see below). They're working on this... This isn't the fault of the language.

5. Has poor shared library support (although this has grown significantly). It's very difficult to interface against a C library, say as a plugin. You can easily wrap and export D functions that are wrapped in C (with a portable built-in syntax as well!) but there are symbol resolution problems because of the GC. Best chance here is to just not use the GC. This isn't the fault of the language.

6. The worst of all of them, poor library support. There is no alternative to Boost in D. *However*, you can easily interface with any library that uses C such as SDL, OpenAL, CSFML, OpenGL, and so on. I'd say this is a poor reason to not use the language actually. This isn't the fault of the language.

7. Unstable language. They're currently considering doing things like removing "delete" as it's apparently deprecated (which will officially make it not usable as an SP language). They're considering removing ordered parameters. While parameters are still given actual order in the case of ASM usage, it can complicates things and will also increase compile times. However, in its defense, they don't plan on doing things as to where tomorrows change makes yesterdays code invalid and they don't care to carry a bunch of deprecated baggage which they take into account. While these discussions pop up a lot, it usually doesn't go into effect unless the benefits are really worth it.

8. Optlink, the Windows linker used in DMC and DMD, is absolute garbage. I don't program in Windows anymore. The Linux version of DMD uses the native linker, ld. However, let me assure you that I've incurred the wrath of optlink. It's considered to be fast (and boy is it fast) mostly because it was hand written and optimized in concurrent assembly (I kid you not). However, the stability of optlink is rather poor and causes linker problems. You'll often have basic problems coming from internal errors of optlink. In response to this, Walter decided to, instead of use ld or some other stable linker, to convert optlink to C. Whenever I was on Windows, I used DMD in a MinGW environment, compiled my code into object files then hand linked my files using MinGW's ld(?). A real pain the ass.

***
The D community is active and you'll get plenty of help either on the IRC channel or the mailing list. The language is very intuitive and I think it's interesting but... it's difficult to use currently and not being able to link against Phobos dynamically or able to use the GC is kinda a turn off to me.

That and I really wish they would have allowed for a better explicit allocation support. The GC really feels like it causes 10x more problems than it solves and some people don't even want it. I end up using my own "standard library" just to assure that I don't run into major GC problems.
Last edited on

The GC really feels like it causes 10x more problems than it solves and some people don't even want it


Because their GC technology is very immature. They use GC like in Java 1.0. Wait... Wrong, the Java 1.0 GC at least guaranteed collection of all dead objects. D's GC doesn't.
closed account (S6k9GNh0)
Yeah, it needs work but they rely to much currently on the GC and it's causing problems. There's actually a patched Phobos for DMD somewhere that removes the GC although it doesn't work anymore.

I dunno, I just think D needs more time to fix fundamental things.
Last edited on

I dunno, I just think D needs more time to fix fundamental things.


They were saying this 2 years ago. Why ever use D if Scala is already production-ready, has faster runtime, provides more libraries and has at least two production ready IDEs?
Last edited on
Because some people don't like/understand functional programming? I still don't really get it. Maybe I should learn Scala, it might be a gentler introduction than Haskell.
closed account (S6k9GNh0)
D's goal is to be a better C++. It looks *awesome* on paper and it's growing in implementation. Scala and D do not have the same goal and are not the same thing. Not sure why you brought that up.
Last edited on
D is heading very much towards functional programming. Scala does exactly the same. D tries to be a better C++ just as Scala tries to be a better Java. The difference is that Scala has already achieved that and D not. Looking just at the feature set, D has much more in common with Scala than with C++ (note that D removes probably the most important feature of C++ that makes C++ so powerful: templates and replaces it with something even weaker than Java generics).
Last edited on
closed account (S6k9GNh0)
WTF no its not. I say this because it must keep major type compatibility with C and this requires pointers and mutable data. this is because it's a systems programming language. It's wanting to have both sides.

Also, D has templates very similar to what's used in C++. The main difference is the syntax used to simplify the grammar. Get your facts straight.
Last edited on
I don't know much about D. But I did recently bump into a forum post which linked
Andrei Alexandrescu with D. And maybe his comments about D might be of interest?

It has led me to take the language more seriously.

Andy

Interview with Andrei Alexandrescu
http://www.informit.com/articles/article.aspx?p=1621867

In part 1 of this three-part series, Eric Niebler talks with his pal and fellow InformIT contributor Andrei Alexandrescu about the D programming language and Andrei's new book about it: what makes D different from other languages, whether D's class libraries rival those of Java and .NET, and why Andrei claims not to be a guru.

And on YouTube.com:

A Google TechTalk:
Three Cool Things About D - The Case for the D Programing Language
http://www.youtube.com/watch?v=RlVpPstLPEc

And a promo for his new book:
The D Programming Language with Andrei Alexandrescu
http://www.youtube.com/watch?v=QXJB7TXhbHc
Last edited on

WTF no its not. I say this because it must keep major type compatibility with C and this requires pointers and mutable data. this is because it's a systems programming language. It's wanting to have both sides.


Scala also has pointers and mutable data. No difference here.
And, if it is a systems programming language, name at least one system or engine using D at its core. There is more system-level code written in Java than in D. Cough. :D


Also, D has templates very similar to what's used in C++.


But you can't do metaprogramming with them. So the one most obvious advantage of C++ templates is gone, while one of the main advantage of Java generics over C++ templates (type bounds) is not there. And forget about type variance specifications (C# 4.0 and Scala only). C# and Scala got better generics and they are there already. So why use D, if it even doesn't have a good IDE? Does it have at least a stable compiler and standard library?

The problem of D is that it is just a mixup of features found in other languages (nothing original) able to attract only C++ programmers. While some other modern languages (e.g. Clojure or Scala) were able to attract developers from different camps, mainly from the Java camp, FP camp (mostly Haskell and OCaml) and C++ camp.
Last edited on
closed account (S6k9GNh0)
Once again, spouting nonsense and garbage. D is capable of metaprogramming just as well if not better than C++.

http://www.the-interweb.com/serendipity/index.php?/archives/66-Template-meta-programming-in-D.html

Also, given the age of D, it's difficult to say that anything mature and low-level has been made in D. However, there are various example operating systems made in D.

D has various IDE solutions through Eclipse, Visual Studio, Mono Develop, and so on. There are plenty of stable build systems to work with and even a patch for Cmake for D.

Outside of the problems I already discussed about Windows, DMD, GDC, and LDC are all reaching production quality.

Outside of the problems I already stated with the garbage collector, the Phobos library (which is currently the standard library) is fine although it may not have the same feel as the C++ STD and STL classes and utilities.

Really, your reputation to spout things that are *wrong* should be enough for people to start ignoring your opinion. I'll admit the problems of D but I won't admit things that aren't true.
Last edited on

D has various IDE solutions through Eclipse, Visual Studio, Mono Develop, and so on. There are plenty of stable build systems to work with and even a patch for Cmake for D.


These are Java, C# and C++ IDEs. The D language plugin for them is alpha quality. Syntax highlighting is not enough. I know this from some hardcore C++ programmers trying D, so it must be true. C++ programmers usually don't have high expectations for their IDE - so a C++ programmer saying that IDE is crap means it definitely is crap (IntelliSense or refactoring features don't work for C++ in general as well as they do for C#, F#, Java or Scala).


Once again, spouting nonsense and garbage. D is capable of metaprogramming just as well if not better than C++.


Ok, point taken. Last time I checked it either wasn't capable or wasn't documented.


However, there are various example operating systems made in D.


I'm not interested in toy examples. And probably noone cares for yet another operating system - this market is already taken by C and nothing is going to change it in next 10 years. Show me a system level code running in production, which brings money to someone. If they haven't managed to do that for several years (D is just the same age as Scala), they won't do it, IMHO. It might be a nice language, but still a toy for hobbyists, not for serious business.
Last edited on
closed account (S6k9GNh0)
Dude, you're not going to get that. Most kernels aren't that young to even have that choice. Stop bringing up the poorest of examples and arguments to try and prove a point that's rather obviously not there. There's only a handful of viable kernels now adays and almost all of them were years before the time of D and many other programming languages for that matter.

Most kernels aren't implemented in C++ but C++ is still considered a systems programming language.

EDIT: As far as IDE, support, not much is given because it's not exactly of high priority. There are more dedicated IDE's for D but they aren't cross-platform.

I'm not sure what you're wanting from the IDE but the only thing incomplete on a majority of the IDE currently is really code completion. Don't take my word for it however, ask everyone on the D mailing list, the IRC channel, wherever. I don't use an IDE.
Last edited on

I'm not sure what you're wanting from the IDE but the only thing incomplete on a majority of the IDE currently is really code completion


Code completion is pretty much a basic feature. Without it, IDE is not more than a fancy editor. So no surprise, you don't use it. I don't need syntax highlighting as much as code completion.

But you also forgot:
- error highlighting (not just syntactical errors, type errors too)
- code style inspections (things like find bugs etc.)
- type-aware refactoring
- stable debugger
- documentation support


Stop bringing up the poorest of examples and arguments to try and prove a point that's rather obviously not there

It was you who mentioned that operating system example first. I asked for system-level code in D. Not operating system.
Java is also considered systems programming language. Show me a deployed, up and running large-scale example of:
- database engine
- webserver engine
- web framework
- GUI toolkit
- game engine
- middleware stack
- application server
- async messaging system
- algorithmic trading platform

These are things C, C++ and Java are equally used now. I can't see any D adoption in these categories. D is a systems programming language, noone write serious systems in.
Last edited on
closed account (S6k9GNh0)
I *just* said that I don't use an IDE and even hinted that you should check up on your facts before you blabbered.

Given that using C (and some C++) libraries in D is simplicity itself, I'm not sure the problem. Creating libraries from scratch take time and effort. The language is also immature which I've already stated.

Java, C, and C++ all have a community several times larger and has been around longer. Once again, your point is incredibly bad.

You suck at debate. You constantly drop out on points that you lose on. Then you move on to spout either more nonsense or just irritate. You're incredibly unproductive. I'm also unsure why you love Java so much yet you seem to be on a forum about C++ quite a lot.

EDIT: I don't think Java is a natural systems programming language.
Last edited on

Java, C, and C++ all have a community several times larger and has been around longer. Once again, your point is incredibly bad.


Scala - 2005 (6 years old)
D - 1999 (12 years old)
Java - 1995 (16 years old)
Java at the age of D was already a #1 general purpose language.

Scala is twice younger and is far, far ahead in terms of community, support and success stories.
If D can't do that in 10 years, it won't do that, ever, unless something totally impossible happens like Microsoft/Google/Apple taking D as the main language for their next platform.


I don't think Java is a natural systems programming language


Maybe it is not natural, and not intended by its creators, but it is the de facto systems programming language, on par with C and C++. There is even hardware supporting it directly (BlueRay, some ARMs, big Azul servers etc.). And your argument D is a systems programming language is wrong if noone is doing systems programming in it. It seems you can't give *any* good counterexample showing I'm wrong, so you resorted to ad hominem arguments.


I *just* said that I don't use an IDE


And I *just* said there is no good IDE for D. Please show me any capable of doing basic things that are expected from an IDE. But you don't know what is generally expected, because you don't use IDE. Syntax highlighting is not enough. Until there is no IDE support, forget about wider adoption of D. Companies don't have money to pay people for programming in notepad or vi. You may do it for your toy projects, but not for serious development, where time is money.

Let me quote the OP:

Any features you miss from C++?


- Decent IDE. It doesn't matter you don't need it. Millions of other developers need it. Companies need it.
- Rock solid compiler
- Rock solid libraries
- Stability
- Performance (current GC implementation is unacceptable, compiler also could be better; and no - manual memory management in a GCed language doesn't bring any performance advantage)

There are also lots of features I miss both in D and in C++, but this is another topic.
Last edited on
I don't see the point of D. If you want something higher-level than C++, use C#, Java or even a scripting language like Python. If you want a low-level language, other than assembly, you should use C. If you want something in between, use C++.
closed account (S6k9GNh0)
chrisname, it's not supposed to be higher level than C++. It's supposed to be a C++ replacement.

Also, there's a difference between D1 and D2. D1 is considerably more stable. D2 is considerably more modern. However, D1 is falling out of favor as D2 is the successor of D1.
Last edited on
Correct me if I'm wrong, but from what I've heard, D is a "replacement" of C++ that doesn't work (it's unstable), has no real standard library (or it has two, I can't remember which), and which no-one in the real world uses.
Pages: 123