Hacker News new | ask | show | jobs
by axilmar 4376 days ago
Not really. The term "complete replacement" does not refer to the implementation details, but to the features the language provides.

It's quite possible not only to offer a complete C++ replacement but to also substantially improve on C++ on all aspects.

1 comments

Not really.

Probably the strongest point of C++, besides its performance, is its ability to interact with C easily and efficiently.

A huge amount of C++'s complexity comes from this requirement, but the benefits are enormous. It's such a big deal that MS eventually just started recommending people use C++/CLI to interop with C instead of using the usual C# Interop methods.

Too many people underestimate the extreme advantages that are still gotten today by that requirement.

The rest of it, yes, you could, but not that specific requirement. Doing that efficiently and easily enforces certain restrictions on the language, and the underlying runtime.

I actually think the strongest point of C++ is the nature of how template metaprogramming is done. Is there any other language that competes with C++ as effectively with templates? I feel like all these "C++ is bad" comments and articles are from people who've really only scratched the surface in C++. The expressiveness that's available to a programmer using templates in C++ is, to me, quite awesome.
The question you should ask yourself is - what other languages I do know to compare C++ to?

Do you know about hygienic macros in scheme? Standard ML parametric polymorphism? Haskell type classes?

But even more mundane stuff like D's templates? Code-generation and reflection in C# (not to mention generics)? Scala's generics and parametric polymorphism?

C++ actually allows for type abstraction in a way that most mainstream languages don't.

There's definitely an argument for the expressiveness of the language, but what you're talking about is more of a mechanical aspect of the C++ language itself.

What I'm talking about is more about the usefulness of the language in a practical sense, not what it allows you to express.

Yeah, but, the usefulness is a function of the expressiveness.

The reason I picked C++ templates in particular was because they allow you to make very effective use of information at compile time. Other languages, at least in my experience, don't give me ways to really tell the compiler (or interpreter) my intentions as effectively as C++ allows me to when I'm using template metaprogramming. So, to that effect, C++ is superior on top of just C compatibility.

... Not that any of this takes away from your original argument.