by Guthur · 12y ago · 0 comments
Is it lambdas? been around for literally decades. Is it type deduction? again been around for quite some time, far better type inference has been available in the likes of Haskell for quite some time. Is it addition of a particular threading model to the standard? this has always been available via some form of library, it just know means the language is truly obsolete if the model changes. Allow GC'd implementations? again decades.
What is modern about any of features that have been added?
Nothing. On the other hand, which features of a “modern” language are missing in C++ by now? Type deduction is still a bit less powerful than in Haskell, yes, but apart from that I can’t really think of anything that may or may not be missing.
This in turn implies that C++ allows essentially any style of coding you may wish for at the moment while at the same time staying some orders of magnitude faster than essentially the entire competition.
* Hygienic macro system. * Pattern matching. * Strong generic type system. * Persistent containers. * Lockless data structures. * Memory-safety. * Null-safety. * Reflection. * Dynamic/variant types. * Modules. * ...
The real wins in performance for real world applications are in terms of algorithmic complexity. A poorly implemented solution in C++ will still be slow, the language does not make it fast.
Any micro optimization you can make with C++ will be an order magnitude less significant than O(log n) vs O(n).
The likes of Janestreet will likely need high performance software yet have great success with Ocaml for example, which incidentally can be very fast.
Just saying C++ is fast does not make programs written in C++ actually fast.
Yet a well written implementation in C++ will still be faster than an equally well-written implementation in, say, Python or Haskell or whatever. Not in an asymptotic sense, but easily by a factor ranging between two and 200. For me, this can be the difference between waiting a couple of weeks or half a year for some computation to complete :)
> Just saying C++ is fast does not make programs written in C++ actually fast.
Of course not, but C++ makes it possible for programs written in C++ to be fast.
Is it possible to write programs in other languages that are just as fast as good C++ implementations? Often it is not.
That performance comes at a cost, it really depends on what your application is. Horses for courses.
Wrong. See (from about 46min): http://channel9.msdn.com/Events/Build/2014/2-661
I’m not sure about threads (and how light/heavy those currently in C++11 are).
[0] https://stackoverflow.com/questions/34125/which-if-any-c-com...
Not writing modern C++ means:
- writing C++ as if it was plain C
- doing OO programming with big object graphs
- manual memory management
- not using the standard containers and algorithms
- writing functor objects
Modula-3 generics are good enough to even implement reference counting data structures.
The going VM craziness of the last two decades pushed such languages away from the mainstream and thus younger generations get surprised by such approaches.
Ever heard of weak_ptr?
Comparing a later version of language to an earlier one to measure modernism seems rather pointless.
C++ is a production ready systems language, not a theoretical CS research paper. How do you propose we define modern in this context then? As I'm sure you're aware, it takes years to vet design features, debate whether they can be implemented, whether they affect performance, whether they have unintended side-effects, whether they break existing code, etc. 'Modern' concepts are already old by then. Also, sometimes features can't be added to a language because of practical real-world issues that have nothing to do with the language itself. (e.g. longer compile times).
I don't see anything particularly wrong with calling a language modern as it adopts features. Certainly, I would agree that one should not then claim the language to be modern in the sense of cutting edge research.
Lambdas have been understood for many many years, the same goes for GC. The were not only in the domain of academia.
Common Lisp has many of these features and more, being a multi-paradigm programming language. And has been used in industry for many many years. Yet people say CL is antiquated while it has so called 'modern' features.
Close to none of course, but that isn't the point AFAIK.
The point is all of them have now been added, hence the 'modern' connotation, and another part of the point is that C++ now even more is a language rather flawlessly combining all those paradigms.