On Mar 4, 2014, at 10:20 AM, Vojtěch Král <[email protected]> wrote:
> Hi > > On 2014-03-04 05:56, Jason H wrote: > >> I just got done going over the module slides. I hadn't heard of them, but >> they seem like a really good idea. >> >> If you think headers are a good thing, read them: >> http://llvm.org/devmtg/2012-11/Gregor-Modules.pdf >> >> Why do you need over 1 meg of headers for an 80 byte file? People turn to >> PCH, but that's just doubling down on a mistake. >> > Obviously headers have some problems, especially performance. But they also > have benefits, which are also, as you may notice, mentioned in this > presentation. The most prominent one is programmer being able to see the > general structure of API in a heaeder file. When working in Python or Java, I > have sometimes missed headers, because it's quite hard to observe general > structure of a 5000 lines Java class, for example. Notice the slide named > "Embrace Headers”? That is actually, or could at least be seen as, a problem of “presentation”. An intelligent “collapse all implementation” in your editor would give you the API overview. But, headers in C++ are not just an overview of the API, for example a class declaration also defines the actual layout of the class and its members in memory. So, while we are able to arbitrarily reorder function definitions in source files, that’s not advisable in the header/declaration. That’s a problem (and a feature!) that’s inherent in C++, and does not exist in Java/C#/Python/…, and IMO would make it very ugly to auto-generate headers or have pure “definition is in declaration” style code. > The module system sure sounds like a nice idea. I'd love not to be forced to > implement PIMPL by hand any more, for example. But there are points to keep > in mind: 1) it's not going to make headers go away, not any time soon anyway, > to me it looks rather like a way to make headers more efficient, and 2) > module system introduces quite a lot of additional complexity. Modules > formerly should've been a C++11 feature, but were 'headed for a TR', which is > nowhere in sight as far as I know. > > Regards, VK > >> From: Jason H <[email protected]> >> To: "[email protected]" <[email protected]> >> Sent: Monday, March 3, 2014 11:49 PM >> Subject: Re: [Qt-creator] Whacky thought of the day >> >> Headers are not a feature. They violate DRY, and create additional >> maintenance. They are a hack to deal with C++ compiler limitations to >> provide quick type checking and parameter matching. If it could be done over >> (and it has with Java, Python, and C#) they would not continue to separate >> prototypes from implementation. Your tools should do the work, not you. >> There is nothing the separation adds, other than additional work an chance >> for errors. >> >> >> From: Vojtěch Král <[email protected]> >> To: [email protected] >> Sent: Monday, March 3, 2014 8:37 PM >> Subject: Re: [Qt-creator] Whacky thought of the day >> >> Hi, >> I don't really see why you would want to do something like that. Headers are >> a feature, not a bug. I don't think many people would regard that as an >> "elevation". >> Regards, VK >> On 2014-03-04 01:17, Jason H wrote: >> So Qt comes along and helps kick C++ into the modern era. I was wondering >> if we could use Qt Creator to address one of my remaining complaints of C++. >> >> I really like languages like Python, C#, and Java where there is only an >> implementation file. While we can't get rid of headers, it would be cool if >> we could define a class file that gets split by QtCreator or qmake that >> would prepare the .h and .cpp files from a unified file. >> >> Creator helps with the maintaining the header and the C with the light bulb, >> but this isn't as elegant as having one file that controls both. I'm >> wondering if its possible and f clang would be any help in reaching this new >> level of elevating C++? >> >> _______________________________________________ >> Qt-creator mailing list >> >> [email protected]http://lists.qt-project.org/mailman/listinfo/qt-creator >> >> _______________________________________________ >> Qt-creator mailing list >> [email protected] >> http://lists.qt-project.org/mailman/listinfo/qt-creator >> >> >> >> _______________________________________________ >> Qt-creator mailing list >> [email protected] >> http://lists.qt-project.org/mailman/listinfo/qt-creator >> >> >> >> _______________________________________________ >> Qt-creator mailing list >> >> [email protected]http://lists.qt-project.org/mailman/listinfo/qt-creator > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/qt-creator -- Eike Ziller, Senior Software Engineer - Digia, Qt Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius Sitz der Gesellschaft: Berlin. Registergericht: Amtsgericht Charlottenburg, HRB 144331 B _______________________________________________ Qt-creator mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/qt-creator
