Jamie wrote:
I'm an RAII fan so I see taking C++ but making it garbage collected as blasphemy. I klnow there's other differences too but it doesn't appeal very much as a language to me.
D has a keyword dedicated to RAII. Also, don't confuse garbage collection with RAII.
me22 wrote:
I don't think D offers enough of an advantage for anyone to bother switching.
It's lacking in libraries, but I've found it usable for game development. It fixes some of my gripes with C++, but adds other annoyances in the process.
Reasons not to switch:
1.) No real IDE for it yet. Codeblocks has a plugin for it, unfortunately it's no Visual Studio.
2.) The compiler makes some fat executables (270KB at least)
3.) There are multiple standard libraries for it floating around. This obviously causes problems if you're using the wrong one.
4.) The compiler doesn't always give very useful error messages. Can be very annoying. Errors are typically readable/comprhensible though
5.) Slightly worse performance than the usual C++ compilers
6.) Only has two compilers at the moment.
7.) D decided to take a weird approach to operator overloading. Coincidentally, I find it not as powerful/useful as C++'s.
8.) It's compiled to native code (unlike c#/java managed code). I decided to count this against D since, at least to me, having a JIT would be more useful. I have little knowledge of VM's and JIT, so perhaps this even a good thing :\
Reasons to switch from C++:
1.) Much faster compile times
2.) D is easier to parse than c++, and the parser for the DMD compiler is openly available. Because of this there's already a tool that compiles your application by parsing it and including all the needed libraries with a simple call like:
Code:
$ rebuild myfile.d
3.) Cleans up some of the dirty c++ syntax, but is still about the same (like Java/C#). Makes switching fairly painless.
4.) It's garbage collected by default, but you may continue to use pointers and such in the usual C way. Garbage collector may be disabled with extra work (why bother).
5.) Still pretty portable. DMD compiler has native windows and linux, and the gcc D compiler works for win/lin/mac I'm told (not sure how well).
6.) It has prettier template syntax than C++. Its templates arguably have more power behind them via some of the compile-time things the compiler lets you do.
7.) uses java-like modules/packages rather than the crappy #include stuff
8.) Misc useful additions: functions/classes defined inside functions, no more declaring classes/functions, array literals, and anonymous functions.
Everything said applied to D 1.0. D 2.0 is the next major update to the language that's in alpha stage now, containing more changes/additions that are certain to break backwards compatibility with D 1.0 :(