Hacker News new | ask | show | jobs
by charles-salvia 3349 days ago
While I kind of like D, it's hard to really make the case for using it. The thing is, it simply doesn't provide that much of a significant advantage over modern C++14/17 to make it worthwhile. At least Rust introduces an entirely innovative new concept with the borrow checker. D is just basically C++ with optional garbage collection and better syntax for meta programming, but without the vast Universe of existing C++ libraries to leverage.
3 comments

> D is just basically C++ with optional garbage collection and better syntax for meta programming, but without the vast Universe of existing C++ libraries to leverage.

Phobos, the D standard library, makes C++ standard library look very small. C++14 standard library still can't do "ls", "execvp", "socket" in a portable way (but we finally got std::thread and std::function!). Phobos can do all of this, and also haves support for md5, gzip, diff, sort, getopt, json, xml, ...

Thus the need for an external library is a lot less likely than it is in C or C++, and you almost never spend time rewrapping native stuff: it's already done by Phobos.

And in the end, if you need to use some specialized library, D can call C and C++ functions with zero overhead (I have D projects that use CGAL and SDL).

D compile times alone are an advantage. I should probably point out that D can actually do some (More than anyone else) C++ interop.
D also has nice opt-in reflection as an advantage over C++ (though there are C++ tools to make up for it, to an extent).

The reflection is IMO the killer individual feature (well, hand-in-hand with the codegen to actually use it). The rest is just the benefit of 1000 small things that all add up to a greater whole.

Yeah, automatic static reflection for serialization of standard-layout structs in C++ would certainly be nice. You can achieve something like that with std::tuple, but it's certainly not comparable to first-class serialization.

PS, I used to enjoy your posts on SDN, before the site owner threw a fit. :-)