4 ms·
Even if C++26 covers all scenarios needed for MOC, it is going to take ages until Qt can rely on it being available across all their customer platforms, unfortu
by pjmlp 1y ago
Even if C++26 covers all scenarios needed for MOC, it is going to take ages until Qt can rely on it being available across all their customer platforms, unfortunely after a spike in the last decades regarding ISO C++ support, the compilers velocity has slowed down, while proprietary compilers have decided to freeze their support somewhere between C++14 and C++17.
Most likely the raise of AOT compiled alternatives, for scenarios where C and C++ were only being used due to being compiled languages, big names in C++ compiler world rather put money on their own alternatives, are the two main reasons of the slow down.
- https://en.cppreference.com/w/cpp/compiler_support.html https://en.cppreference.com/w/cpp/compiler_support.html
- https://en.cppreference.com/w/cpp/compiler_support/17.html https://en.cppreference.com/w/cpp/compiler_support/17.html
- https://en.cppreference.com/w/cpp/compiler_support/14.html https://en.cppreference.com/w/cpp/compiler_support/14.html
- HarHarVeryFunny 1y agoWhat are all the use cases for MOC? I used to use Qt quite extensively years ago, and it seemed that all MOC was really bringing to the table was signal-slot connections which can certainly be done in much nicer ways (e.g. just use std::function to represent signals).
- badsectoracula 1y agoThat is what the linked article is about: what moc provides and what the pure C++ equivalent (if any) could be.
- ghosty141 1y agoIf you use QML it does, like... everything? QML can't interact with native C++ at all, you must use the MOC to generate Q_PROPERTYs, signal/slots, the Q_OBJECT macro itself etc.
- motorest 1y ago> I used to use Qt quite extensively years ago, and it seemed that all MOC was really bringing to the table was signal-slot connections which can certainly be done in much nicer ways (e.g. just use std::function to represent signals). The linked article goes into detail on what are the use cases for MOC and what are the shortcomings of C++26 to completely replace MOC with C++ reflections. If you read the article, the goal they are aiming for is replacing MOC with C++ reflections without requiring fundamental changes to how Qt works. There are many reputable and very stable signal&slots implementations in C++ that are both type safe and do not require reflection at all. Some of these projects exist for over a decade already, and required only C++14. But Qt's implementations of signals and slots require far more than that to have a drop-in replacement.
- curious9999 1y ago> Most likely the raise of AOT compiled alternatives, for scenarios where C and C++ were only being used due to being compiled languages, big names in C++ compiler world rather put money on their own alternatives, are the two main reasons of the slow down. What alternatives? Rust claws at market share but has problems with basic stuff like doubly linked lists, WIP gccrs and memory unsafety, Carbon looks like a meme with too few people working on it, Ada has a neglected dialect and a proprietary dialect, Go has garbage collection, Zig has not even reached 1.0, Swift is more of an application language than a systems language, Circle is dead. What else is there? Not that C++ doesn't have challenges.
- michaelsbradley 1y ago> What else is there? There’s Nim, which is getting a major overhaul for v3 (cf. Nimony).
- pjmlp 1y agoGo, Java (GraalVM/OpenJ9), .NET (Native AOT, .NET Native, IL2CPP, Mono AOT), Swift, Objective-C, D, Nim, Ada. Many people that use C and C++, do it out of habit, any compiled language, even with AOT is capable to deliver for most scenarios in userspace code. 99% of user software written in compiled languages isn't systems programming juggling pointers and type casts. Even when that is the case, all above languages have FFI features, no need to rewrite the whole thing. You might have noticed that C and C++ are minority languages in the mobile OS duopoly, for starters, being used only for low level OS services, and game engines.
- curious9999_2 1y agoI think it is fine for C and C++ to be relegated for use caches where they make the most sense. I don't see the point of comparing them to niches, markets or cases where for instance garbage collection is fine. And, I already mentioned Go, Swift and Ada. Objective-C is not really on my radar, it's specific to Apple, and it doesn't seem like Apple is betting on it for the future. D and Nim are languages with low momentum relative to others. I am not sure the AOT approach will work. Maybe, maybe not. There are direct and indirect obstacles, I believe. D is probably interesting here; as I understand it, it supported both GC and no-GC. But, that meant that a lot of libraries used GC, and thus were not necessarily good options for applications that required no-GC. In some ways, a programming language can also be what people build with it and what its ecosystems are like.
- npalli 1y agoWhere are you seeing proprietary compilers freezing support after C++17. C++20 support is almost green across the board (even Cray) and C++23 is getting there. As usual there is a lag, for ex. when nvcc will declare C++23 support and whole swath will turn green. Right now it only supports C++20 (but you can mix in C++23 files and link them together) etc.. I see most C++ projects make C++20 a minimum. (not counting someone who wants to keep running C++98).
- pjmlp 1y agoEasy, go hunting their manuals for the compilers that aren't yet another clang fork, still a few around between TI, Microchip and co on embedded. In general, not for Qt deployment scenarios, also take into consideration the surviving big iron UNIX, mainframes and micros still in business, again the compilers that are yet not clang forks. The table is a non exaustive overview, however it also paints the picture that for those that care about real portable code, regular visits to the table are required before considering adopting any specific new feature, or the need to enforce style guides like "we use C++20, but feature X, Y, Z are forbidden due to lack of portablity".
- detaro 1y agoBut Qt doesn't care for microcontrollers, nor mainframes. The most exotic target they have is QNX, but "Qt needs C++XX" seems to be a pretty good motivator for QNX to update their compilers, which are gcc-based after all.
- pjmlp 1y agoThey care about all of these, https://doc.qt.io/qt-6/supported-platforms.html https://doc.qt.io/qt-6/supported-platforms.html I do see exotic stuff like INTEGRITY as well, still the point stands all those platforms listed on the page have to support C++26 in the Compiler column as the reference compiler.