6 ms·
If I understand things correctly, the C++ people are attempting to modernize the language and add a bunch of new stuff with the intention of deprecating the old
by 01100011 8y ago
If I understand things correctly, the C++ people are attempting to modernize the language and add a bunch of new stuff with the intention of deprecating the old stuff. They're constrained by legacy cruft so the new features end up with rather ugly syntax. I applaud their efforts but frankly I'd rather see a new language done right.
I'm currently trying to modernize my C++ skills and while I love some of the new features I think they're creating an inconsistent, ugly, beast of a language.
- wvenable 8y agoC++ will always have a place because it's a language that literally has (or will have) everything. I've used features of C++ that have no analogy in other languages. If I designed a language tomorrow, I wouldn't put that feature in. Too obscure. But I needed this random feature for a project on a constrained device to do C callback trampolines to C++ object methods. When it comes to C++, there is no magic alternative that is "done right". I think that Rust may be the closest C++ alternative that will get in our lifetime and it's syntax isn't exactly non-ugly either.
- mschuetz 8y agoIt has far from "literally" everything. It doesn't have async/await, doesn't have a sane way to create simple web servers, doesn't have map/find/filter/etc on collections, at least not a version that won't span multiple lines or the whole screen because they require mandatory arguments (begin, end) that are useless 99% of the time because you want to operate on the whole collection anyway, etc.
- geezerjay 8y ago> It doesn't have async/await, That's just a C# idiom, and far from being the right or sane way to handle concurrency. Meanwhile C++ has active objects and futures and other concurrency design patterns. > doesn't have a sane way to create simple web servers Check POCO. > doesn't have map/find/filter/etc on collections, at least not a version that won't span multiple lines or the whole screen because they require mandatory arguments (begin, end) that are useless 99% of the time because you want to operate on the whole collection anyway, etc. That's a very silly complaint. You acknowledge that C++ does have map/find/filter (which at this stage is rather obvious to anyone who ever used C++) but somehow you're complaining that C++'s interfaces require programmers to specify where the collections should start and finnish.
- vardump 8y ago> but somehow you're complaining that C++'s interfaces require programmers to specify where the collections should start and finnish. I think it is a valid complaint. Most of time you want to apply something like "find" to the whole collection. I'd also love to have C++ standard maps (esp. unordered_map) where I only pay for what I use. Namely, due to C++ spec I have to pay for the nodes instead of having a flat, CPU cache efficient, buffer. In other words, a different map type where other items are allowed to move in memory when something is inserted or removed. Oh, while we're at it, it'd be nice if vectors etc. could realloc instead of allocating a completely new memory region and freeing the old one when more space is required. A more ergonomic allocator story for specifying alternative allocators would also be very nice for some niches, like when you need to avoid fragmentation or require better performance in embedded development.
- BurnGpuBurn 8y agoMemory allocation by STL has been broken for as long as I remember, which is at least twelve years or so. It's been a while but if I remember correctly it doubled its allocation every time it ran out or space.
- NullPrefix 8y agothis is implementation specific. Care to tell which compiler are you talking about?
- jcelerier 8y ago> It's been a while but if I remember correctly it doubled its allocation every time it ran out or space. why would you call this "broken" ? That's one of the most optimal solutions for reallocations if you append values continuously, since it will reallocate only logarithmically.
- gmadsen 8y agowhat? ha, that is the text book approach to reallocating an array for additional values to get log complexity
- geezerjay 8y ago> C++ will always have a place because it's a language that literally has (or will have) everything. I don't think that's true at this stage. Nowadays, beyond legacy code, C++ is used mainly in embedded, number-crunching, and cross-platform GUI applicationd, and that's about it. Meanwhile the world has moved on to web services and web apps, where C++ is nowhere to be seen, and other competing lower-level programming languages are starting to eat away C++'s lunch.
- brobdingnagians 8y agoDon't forget high performance games; which is a huge market, highly complex, and very competitive.
- ahartmetz 8y agoC++ (Rust as well) is for high complexity problems that need high performance solutions. It's not just a few narrow application areas. For example, all major HTML and JS engines are also written in C++. I wouldn't call them (just) GUI applications. I bet that all offline renderers for professional CGI are also C++.
- pjmlp 8y agoMost of my work is done in Java, .NET and JavaScript, C++ is the only native alternative that I can easily plug into all of them when I need native interop. Go is not an option until they get their story straight with 2.0. Swift is nice, but really it will never go beyond being an Apple platform language. Native/Kotlin is doing its baby steps. D seemed like a nice alternative, but they are such a small community without any big corporation support, that the language might already have lost its opportunity. Rust would be the best alternative, but it still lacks the tooling integration story regarding IDE, graphical debuggers and OS vendors support. Yes, no one is doing pure apps anymore in 100% C++, Java and .NET are slowly migrating to bootstrapped runtimes, but the language is not going away for the foreseeable future. Kids are learning to program on Arduino devices using C++. Microsoft already has some ongoing Rust projects, but Visual Rust is not yet here. AAA Games, compilers specially LLVM and GCC, OS, HPC, Fintech, deep learning, GPGPU shaders, GUI composition engines, IoT, medical devices, car infotainment systems, VFX software might be a niche, but it is a very big niche. One of the good things about polyglot development is that one doesn't need to silo himself/herself as developer X and be worried if language X is suitable for full stack development across all domains of computing. EDIT: typos
- Gibbon1 8y ago> I applaud their efforts but frankly I'd rather see a new language done right. Opinion of mine is what's needed is robust and performant inter-op, and only then a new dialect that fixes some of the deep legacy problems with the language. At least that would provide a clean migration path.
- pjmlp 8y agoBeautiful languages don't get adopted unless there is an OS vendor stating "It is my way or go elsewhere". The languages with higher success rate are the ones that build on existing code and practices. Every language with major market adoption is an inconsistent unless one does a language reboot Perl 6/Python 3 style and is willing to push it forward.
- fpoling 8y agoDo you have an example of a beautiful language that adopted due to vendor stance? I cannot call C# beautiful. Perhaps Swift?
- pjmlp 8y agoI would say C# was quite beautiful in 2001. And yes, Swift as well. Kotlin might eventually be another one, depending how the Java story will evolve past Java 8 on Android.
- saagarjha 8y agoObjective-C?
- jdoege 8y agoI don't know about vendor stance, but Elixir feels fairly elegant (better descriptive word than beautiful, I think.)