Will D replace the C/C++ combo eventually?

2013-01-06 6:39 am
D seems to be designed by some pretty competent C++ experts and I've heard about backwards compatibility existing like it is important in C++,
In your opinion is D worth getting into ?
Do you think it will become the next universal programming language?

回答 (3)

2013-01-06 4:29 pm
✔ 最佳答案
Given few languages make it past the minor cult stage, I believe it is extremely unlikely that D will replace C/C++. I believe I can make that assertion without any argument about the language itself.

If you look at the language then I believe the uninformed assertion still applies, the language will not replace C/C++.

C/C++ is dominant in certain areas because it is a stable language used in software that is both massive in terms of numbers of lines of code and huge in terms of the number of people using it. C/C++ has a huge amount of inertia behind it. C had that inertia originally and C++ gained that inertia by being largely compatible with it, you can consume C code in C++ applications and write C++ code that can be consumed by C.

C++ has many failings as a language. It does not have a proper module system, linking of one compilation with another is done by them sharing text files; modern languages put type information in their object files. It is a massively complex language because it combines a long history with big ambition; modern languages obviously have less history but also often keep their ambitions smaller. Finally its memory model is too close to the physical nature of the computer which leads to it being fragile; a pointer can be trivially or inadvertently be coerced to point anywhere and the memory treated as any type.

C/C++ is probably not the ideal language for developing things other than operating systems and things close to operating systems. In the long term languages used for application development may push down into that space.

Objective-C, Java and C# all stand a far better chance of taking C/C++'s crown but none of them will. Objective-C suffers from many of the same problems as C/C++ and is often seen as an Apple-only language. Java and C# are hampered by politics, Java being a proprietary language of Oracle and C# often being seen as a Microsoft proprietary language.

C# does contain all the elements that might be necessary to dethrone C/C++, it has both a type safe memory model but many features allowing clearly signed doors to be opened into the underlying low-level memory model; C# has both Java-style references and C++-style pointers. But unless Microsoft produce a widely adopted operating system with it to replace Windows, I do not believe C# will not become universal.

More likely something that does not have a procedural ancestry may come to dominance. Perhaps one of the functional language group will make it into the mainstream.
2013-01-06 5:29 pm
C is irrelevant for this comparison, D is not trying to compete with it, and neither does C++.

The strengths of C++ today are:

1. Integrated resource management. No other industrial-strength language offers that, which is why C++ is the only choice for resource-constrained and deterministic applications).

2. Strong static typing, compile-time abstractions, and nearly complete freedom for the optimizers to transform programs. Most other current industrial languages pay runtime price for their abstractions, and many don't even compile their code until runtime, when much of static code analysis is impossible. This, combined, makes C++ the only choice when raw speed is what you need (granted, buying new hardware might be cheaper than paying C++ programmers, C++ is for when you already have the fastest hardware money can buy, and so do your competitors).

3. combined generic and object-oriented programming, which appears to be a winning combination of paradigms for a versatile, all-around useful language (other paradigms are sprinkled in too, as needed).

4. sufficiently archaic C source code can be incorporated, at source level, with minimal and largely automatic changes. I don't think this is important today, but in the 90s this was the reason people picked up C++ in the first place, without any corporation telling them to.

Now, D attempts to be what C++ would be if it didn't try to keep the ability to compile (more or less) C sources. I think it's a good thing (that compatibility raises the complexity of C++ sky-high), and with Alexandrescu behind it, it is worth keeping an eye on the development of D.

As for replacing C++, obviously, nobody will replace billions of lines of existing, tested, working C++ libraries and applications. New development will start considering D here and there, but nowhere as fast as C++ was considered in the early 90s. Back then, there was an urgent need in a portable language capable of abstractions for building software infrastructure. Today, there isn't any urgent need in a simpler C++. The issues with C++ in its own domain are that few people know it well, and they cost a lot. For D to beat C++ there, there needs to be a lot more skilled D programmers.

I don't really see that happening in today's world. High-performance resource-constrained languages are marginalized already - the majority of attention and development worldwide goes to the interpreted or managed languages.

What I think will happen, is that some of the ideas that are developed, fought over, and tried in D will leak into C++, just like so much of C++ was adopted by C. You can already kind of see it start already with the current static if proposal for C++ (although Stroustrup is against it, for good reasons)
2013-01-06 6:48 am
actually, i think F and it's successor FU are way more competent, and will likely outdo both C & D one day.

which reminds me of a joke about how 'Profanity is the one language all programmers know best' ;)
參考: 10 years of writing foo and bar


收錄日期: 2021-04-20 23:34:45
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20130105223955AAcUXxp

檢視 Wayback Machine 備份