Unclear about the benefits of D over C++ and Java
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jan 2 04:46:11 PST 2016
On Saturday, 2 January 2016 at 12:01:20 UTC, Dibyendu Majumdar
wrote:
> To clarify - the reason for my post here is to raise that the
> benefits of D over C++ or Java should be explained right
> up-front on D website in real world terms (i.e. with examples
> and benchmarks) to help people like me.
Ok, that is not something I can help you with, but would you
trust information provided by the language creators on
performance and language feature trade offs?
That said: I really don't think you should consider languages
like D and Rust as replacements for Java. If you use Java, you
usually have dependencies on frameworks/infrastructure and also a
strong preference for garbage collection. Go is closer to being a
replacement for small Java projects. D's garbage collector is
comparable to the C++ Boehm collector (I think Inkscape uses
that).
D is semantically a close cousin of C++, but the standard
libraries are different, although inspired by C++ libraries and
has adopted C++ terminology. And the template programming
semantics are slightly different. Advanced C++ meta programming
is more painful than in other languages because it came about as
an accident, and even simple things can be demanding and verbose
to implement.
D's approach to template programming is pretty straight forward,
nothing spectacular and with some syntactical annoyances, but
without the really weird C++ SFINAE and inheritance constructs
that C++ programmers have to deal with.
D has also implemented some of the features that has been
proposed for C++, but not adopted in C++ yet.
Some areas where C++ is better:
- number of available template libraries
- does not have modular arithmetics for signed integers
- somewhat more powerful lambdas
- more flexible operator overloading
- Objective-C++ integration
- better platform support (e.g. asm.js)
- C++17 brings stackless concurrency
Overall, C++ is more verbose than D and that means that C++
isn't a good language for testing out ideas. D is more suitable
for that.
More information about the Digitalmars-d
mailing list