Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Has any language made a serious attempt to replace C/C++? The only one i know of is D. I'm sure there are others?

share|improve this question

closed as not constructive by Loki Astari, Walter, ChrisF Oct 18 '11 at 15:15

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

9  
What do you mean by "replace"? It seems that Java and C# have made a strong attempt. –  John Fisher Oct 18 '11 at 5:22
2  
What constitutes as "seriously attempt"? Don't all general purpose languages try to? –  Lionel Oct 18 '11 at 5:23
2  
@acidzombie24: Of course they are. What makes you think that C++ is significantly faster than Java or C#. –  Loki Astari Oct 18 '11 at 5:29
4  
@LokiAstari: uhhhhh for one Gosling (creator of java) said it himself. I dont mean speed (although he did say its slower) i mean that java doesnt try to do what C and C++ does. –  acidzombie24 Oct 18 '11 at 5:36
3  
@Ramhound: C and C++ are self-sufficient. You can have computer completely programmed in C or C++ including operating system and standard runtime except for few tiny platform-specific bits in assembly, but you can't write JVM or CLR in Java or C# respectively. So Java/C# don't replace C/C++, because they still need it. –  Jan Hudec Oct 18 '11 at 17:53

6 Answers 6

The D Programming Language is a serious attempt at evolution in the general direction of C++. It's mostly backward compatible with C and partially with C++. It is garbage collected, but it is possible to avoid using it in low-level code if you restrict yourself to specific subset.

The language was designed by some of the best C++ experts. It was first implemented by Digital Mars and now there are also free compilers in GCC and LLVM suites.

Somewhat unfortunate is that there are two standard runtimes for the language, Phobos (the original library from Digital Mars) and a more advanced, but incompatible Tango. This complicates development of other libraries and no language can really take off without decent set of libraries. The early incompatibility between standard runtime and Tango probably slowed down adoption somewhat. New version of the specification (D2) was released last year, but the new features are not yet fully supported by all implementations and some libraries were not yet updated. It's incompatible with version 1, which is not exactly helping adoption either.

share|improve this answer
    
Well, the 2 standard lib problem is solved for a while now. This is sad to see that repeated again and again. This WAS true. This is wrong for years now. –  deadalnix Oct 18 '11 at 14:09
    
@deadalnix: I went to check and noticed there is no mention of incompatibility too. Updated the post. –  Jan Hudec Oct 18 '11 at 17:36
    
The new specification you are talking about is D2. D1 still exists and is still in maintenance mode. However, the tango/phobos problem has been solved in D1 too. The overlapping part of tango and phobos has been merged in druntime and both tango and phobos use it. –  deadalnix Oct 18 '11 at 18:03
3  
If you can really call it solved. It was "solved" because the people who did Tango got tired of being ignored and haven't bothered to update it to work with D2. –  jsternberg Oct 18 '11 at 18:14

You may be interested in the Go programming language by Google.

The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

From the FAQ:

Why are you creating a new language?

Go was born out of frustration with existing languages and environments for systems programming. Programming had become too difficult and the choice of languages was partly to blame. One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream language. Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python and JavaScript rather than C++ or, to a lesser extent, Java.

Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, it is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.

share|improve this answer
10  
Go is only notable because it came out of Google. It also isn't much better than ALGOL68 cowlark.com/2009-11-15-go –  Pubby Oct 18 '11 at 8:21
2  
Google seem like they're on a mission to create the "next big thing" language wise. Go (and the newer Dart) are their first attempts but I think it'll take a few more years before they really come out with something that'll be widely adopted outside of their own bubble. –  MattDavey Oct 18 '11 at 8:26
    
@Pubby8: Go is notable because of the implicit interface implementation and because of the built-in concurrency. But it's true it's a bit rough about other edges, but it should have a potential to evolve. –  Jan Hudec Oct 18 '11 at 12:30
3  
@MattDavey: I don't actually think Google makes coordinated effort to create a new language. They hired bunch of smart people and encourage them to try out bold ideas. Some turn out good and some don't. There are some useful novel ideas in Go while there seem to be none in Dart (see this Rafael Garcia-Suarez' review) –  Jan Hudec Oct 18 '11 at 12:36
    
@Jan Hudec true Google do have a lot of smart people :) When you put it like that it's surprising they don't come out with more languages! I guess C/C++ will never go away, the real innovation with languages these days is much highler level - DSL's, cross compilers etc –  MattDavey Oct 18 '11 at 19:35

There are pushes for other languages to gain popularity, C# being the first that comes to mind. I think there are several reasons none have done so. One reason in the case of C# is that it is a language developed and promoted by Microsoft, and while it may or may not be a good language, it will be less portable (Microsoft has less interest in promoting it on other platforms. I am aware others have re-implemented it). Do you see Apple deciding to use C# for the next iPhone? Doubtful. Portability was the primary reason C was developed and was adopted so well. We really do not want to go back to a different language for each architecture.

Another reason is that despite their age, C and C++ have held up very well. You can still accomplish most any task with them. Most newer languages tend to model a lot of their syntax and behavior after C/C++ because it works so well. We owe a lot to K & R and Stroustrup.

Lastly I think the point that Unix was rewritten in C by Thompson and Ritchie is very significant. While not everything was directly derived from Unix, at this point almost all the major OSs out there have borrowed large chunks of it, or at least imitated it.

To summarize, I think a new language that really wanted to challenge C/C++ would have to have some very significant improvements, but be rock solid. I think it would have to be highly portable and freely available. And I think it would help it a lot if there were something that used it that got it promoted (as C was put in the limelight by Unix).

R.I.P. dmr. We owe a lot to you.

share|improve this answer
2  
+1 for the RIP. And the techie stuff is all good too. –  Phil Lello Oct 18 '11 at 17:42
    
The point that Unix was rewritten in C is that now it was possible to implement operating systems in higher level language. So any later system, even if it didn't borrow anything from Unix, used C or C++ as the only language in which it was known to be possible to write it. –  Jan Hudec Oct 19 '11 at 6:17
    
C was designed for implementing Unix on multiple platforms. That is the job it was intended to do. The "portable assembler". –  user1249 Oct 22 '11 at 22:15

Yes, though they have failed to make breakthroughs to see widespread adoption.

For example, Oberon, by Professor Wirth - it was successful as a systems programming language, was used to implement an OS, Windowing System, and compiler - tasks typically associated with, in the Unix world, C.

There are a set of Pascal derived languages that aimed to do this role - Pascal, Modula, Oberon and so on.

The Ada language may also have equivalent role to C++, but only in safety critical systems programming has it been widely adopted.

share|improve this answer

It depends on what you consider "replaced".

There are certain areas where I think C isn't going to be replaced for quite some time - due to different reasons.

On the other hand say 25 years ago a lot more server side stuff was written in C and C++. A lot of that stuff is today written in Java, so in that area Java has replaced a lot of C and C++. Dynmic languages are also advancing here. On the client side VisualBasic and more recently C# have gained a good marketshare of applications that used to be written in C/C++.

So, in terms of usage there are several replacements for C and C++.

However, if you are looking for a "real" replacement of C and C++, meaning a language with which you can easily shoot yourself in the foot and use as some kind of (perceived) swiss army knife of programming I doubt that there are real replacements to C and C++ out there right now which are getting more and more adapted.

share|improve this answer

Objective-C would seem like an obvious one

share|improve this answer
    
I think Objective-C actually pre-dates C++. However, it's also relatively slow due to all the indirection from the late binding. –  Phil Lello Oct 18 '11 at 17:41
3  
Hmm not so sure, C++ dates back to 1979 (renamed C++ in 1983). Objective C dates back to 1982, which I guess means C++ probably didn't have so much influence on it (at least not as much as Smalltalk) –  MattDavey Oct 18 '11 at 19:34
1  
Ah, I didn't know that. You're a scholar and a gentleman :) –  Phil Lello Oct 18 '11 at 19:41
    
I didn't either, until your comment prompted me to research it haha :) –  MattDavey Oct 18 '11 at 19:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.