I don't want to veer into SG20 territory, but I think we should avoid such blanket statements, especially in academic / learning settings or about students themselves. Situations are diverse here as they are with C++ users in general.It is indeed important to use build systems, and using C++ at scale assuredly involves them, but if we want newcomers to use C++ and understand what they are doing, we definitely want it to be possible to write small C++ programs and compile them easily through the command line. Among other things, as René Ferdinand reminded us, it helps students understand more complex tools better.I'm not convinced standardizing module extensions is really an issue, but let's keep this in mind. It's important that C++ remains usable (if only for learners) as is, with a terminal and a compiler (and yes, they should learn to use build systems, but both are important).Le sam. 16 avr. 2022 à 14:41, Daniel Ruoso via SG15 <sg15@lists.isocpp.org> a écrit :I, personally, think it's time to get over the expectation that it's realistic to use c++ without a build system.Especially in teaching context, we should prepare folks to the real world, which necessarily involves a build system, instead of creating this anachronistic requirements.Daniel_______________________________________________On Sat, Apr 16, 2022, 14:30 Gabriel Dos Reis via SG15 <sg15@lists.isocpp.org> wrote:_______________________________________________Thanks, Daniela.
- So Nico, what is it what you are looking for?
Iâve come to the same conclusion after being (privately) abused by Nico â yes, I answered him on many occasions (including in-person in Prague). My hope is that the wider audience is able to help suss out the actual technical problem that has a solution that scales beyond nice slide presentations.
-- Gaby
From: Ext <ext-bounces@lists.isocpp.org> On Behalf Of Daniela Engert via Ext
Sent: Saturday, April 16, 2022 5:06 AM
To: ext@lists.isocpp.org; sg15@lists.isocpp.org
Cc: dani <dani@ngrt.de>
Subject: Re: [isocpp-ext] [SG15] Can we expect that all C++ source files can have the same suffix?
Hi Nico,
having read all the messages on the respective reflectors, our private conversations and social media, I'm still having trouble to see what you're after.
Neither msvc (the compiler) nor MSBuild (the build system) nor VisualStudio (the IDE with its project system) requires any particular file extension whatsoever to work with modules. In fact, in the beginning when I started seriously investigating this modules thing in 2018, I was uniformly using the .cpp extension with msvc and clang. A year later during my modularization of the {fmt} library I've switched to .cc for the module interface unit because it is the coding convention for all C++ TUs in {fmt}. And both msvc and cmake were happy with it (and still are). And since we have modules in production and active development at my workplace, we conventionally settled on .ixx for the PMIU and kept .cpp for everything else. This turned out to be the most convenient and practical convention *in that particular environment* using *the given toolset* and with cross-platform considerations totally being a non-issue. This .ixx extension for the PMIUs is in no way mandated by any component involved there, I could use .cpp just as well as I did in the beginning. But I appreciate .ixx for the module interfaces simply because they are so pivotal in understanding a module and thus better stand out of the sea of other TUs on the first glance just due to the different shape of the glyphs.
From my understanding of other compilers, this is just the same with them. The real issue is with the build tools that drive the whole compilation process. As a user, I don't actually care about the incantation ceremonies required by compilers, versions, modes etc. This is what MSBuild and the module dependency scanner are taking care of in my development environment. Or CMake might provide in the future. Or any other tool for that matter.
But my biggest beef with the state of the ecosystem is the total lack of understanding of the module semantics by tools like static code analysers and such. My daily experience with them is like I'm talking PlankalkĂŒl to them instead of post-post-post modern C++. đ
So Nico, what is it what you are looking for? It can't be only the file extension given the many of them that are already in existence and use during the past couple of decades.
Ciao
Dani
Am 16.04.2022 um 12:53 schrieb Nico Josuttis via Ext:
Hi Roger,
I agree.
However, cmake and other tools use the command line. So, they would have these problems solved.
Even for Visual Studio, if there is support for arbitrary file extensions and no need for specific command line options, code coming from different compiler can just be used as it is.
So, programmers could have all files with suffix .cpp (as is fine for gcc) and just add them to the Visual Studio project without further action.
While of course VC++ still can reommend special suffixes like .ixx (still I don't know the suffix for internal partitions), the other compilers would not have to adopt their convention and the community will decide which suffix "wins" (as it happened with ".cpp" which came from a Microsoft, although strangly it is not used by them in a modified form for modules).
I will today publish a script that fix the problems Visual Studio has with module files for the command line. That way, programmers can write their first portable module programm... (portable in the practical not formal sense, Gaby).
As usual, correct me if I miss something.
Am 16. April 2022 12:10:03 MESZ schrieb Roger Orr via Ext <ext@lists.isocpp.org>:
Hello Nico,I am slightly puzzled by the use of 'command line' and 'command' in your email.In my own experience I suspect few of the C++ programmers I work with ever compile with a command line; they either work within an IDE or run a build script, likely using cmake. It us unclear to me what is the benefit of seeking a unified command line that most programmers are not even aware of.Regards,Roger.-----Original Message-----From: Ext [mailto:ext-bounces@lists.isocpp.org] On Behalf Of Nico Josuttis via ExtSent: 16 April 2022 07:43To: Gabriel Dos Reis; ext@lists.isocpp.org; sg15@lists.isocpp.orgCc: Nico Josuttis; Nathan SidwellSubject: Re: [isocpp-ext] [SG15] Can we expect that all C++ source files can have the same suffix?Gaby,you want me to tell programmers that we have portable examples, for which unfortunately there is not defined HOW to deal with them?And selling this as "you can use modules in practice"? đ€
Of course for programmers a portable program implies thata) I don't have to rename filesb) I don't have to use different conmand-line options for files having the same suffixc) I can compile all code with a single commandOnce we have that, we can teach content and programmers will use it. So far, the clear conclusion is that you cannot use modules in practice.It would be absolutely no problem to provide that for Visual C++. Ideally ignoring file extensions and analyze C++ file content.Therefore, I wonder why you do not WANT that (and at the same time tell that you are interesting that modules become widely used).And, BTW, I am desperately looking for the file extension Visual C++ expect for internal patition units(to skip /internalPartition).PLEASE just tell us.ThanksAm 15. April 2022 21:46:13 MESZ schrieb Gabriel Dos Reis <gdr@microsoft.com>:Fortunately, there IS a portable C++ example of âhello worldâ program,today.*How* to compile a given source file has always depended on compilers,their environment of invocations, and supporting toolsets. That wonâtchange. And Modules donât have a goal of changing that.Requiring that the set of satellite files that a compiler has to produce depends solely on the contents of the source file, and not on the invocation command lines, isnât going to work in real world, production environments. That is what build systems are for, to abstract over the details. My hope is that professional teaching of programming with modules direct C++ programmers to relying on their build systems.We are having a conversation in SG15 about common ways of describing tobuild systems what are the needs of a program and library, and let thebuild system make the build happens. And that is not restricted tomodules, even though they make the conversation urgent.-- GabyFrom: Nico Josuttis <nico@josuttis.de>Sent: Friday, April 15, 2022 12:05 PMTo: ext@lists.isocpp.org; Gabriel Dos Reis via Ext<ext@lists.isocpp.org>; ext@lists.isocpp.org; sg15@lists.isocpp.orgCc: Gabriel Dos Reis <gdr@microsoft.com>; Nathan Sidwell <nathan@acm.org>Subject: Re: [isocpp-ext] [SG15] Can we expect that all C++ source files can have the same suffix?haha,I REALLY would like to have the first portable "hello module" example.Currently, there is simply no way to have it. That's really a shame.Am 15. April 2022 20:46:59 MESZ schrieb Gabriel Dos Reis via Ext<ext@lists.isocpp.org<mailto:ext@lists.isocpp.org>>:Nathan - you recount is all correct.I know I've mentioned it more than once, but I find it unsettling,given there was great opposition to there being a (two way?) mappingbetween file names and module names, that there is a move in thedirection of making file names 'significant'. ISTM that the desire forbob.$REGULARSUFFIX and alice.$MODULESUFFIX is taking us all the wayback to the first objection above about having two languages.I am not seeing any movement to make filename suffixes significant inthe linguistic interpretation, by the compiler, of the content ofsource file. Maybe I am not looking right; but I would definitelyrecommend against such move. There are extra linguistic considerationsthat might force a toolset (not just a compiler) to require certainsuffixes, but those suffixes do not determine the meaning a C++ program-- this is not different from compilers like GCC or MSVC refusing tocompile in default mode files ending with ".h" or similar because theygenerally have other connotations.For some reasons, the topic of the "right" suffix seems to generatemore passion than the topic of what can we do with modules, so maybe weare already doing a lot with modules đ
-- Gaby-----Original Message-----From: Ext<ext-bounces@lists.isocpp.org<mailto:ext-bounces@lists.isocpp.org>> On Behalf Of Nathan Sidwell via ExtSent: Friday, April 15, 2022 11:21 AMTo: sg15@lists.isocpp.org<mailto:sg15@lists.isocpp.org>; ext@lists.isocpp.org<mailto:ext@lists.isocpp.org>; WG21 Tooling Study Group SG15 <tooling@open-std.org<mailto:tooling@open-std.org>>Cc: Nathan Sidwell <nathan@acm.org<mailto:nathan@acm.org>>Subject: Re: [isocpp-ext] [SG15] Can we expect that all C++ source files can have the same suffix?On 4/13/22 17:10, Nico Josuttis via SG15 wrote:I should add that the fact that we needmodule;at the beginning of the global module fragment was only introduced tolet a file identify itself as module file. If we would requiredifferent suffixes, that would not have been necessary.But correct me if I am wrong.I shall correct you :)Here's the history (as I recall, all persons mentioned are real, andnot to be confused with ficticious characters)* prior to me doing things with gcc, there was only 'module FOO;' as amodule declaration at-most once within a TU. MSVC (the only compilerwith module smarts at the time), had a flag to tell it 'this is aninterface' vs 'this is an implementation'.* I found this unsatisfying, as it meant that there was somethingoutside the source tokens that told you how to interpret them. Ineffect we had two languages.* IIRC, Gaby, Jason (Merrill) and I came up with the 'export moduleFOO;' vs 'module foo;' distinction. But still this could be anywherein the source stream. I was able to implement this functionality to aworking system.* Daveed proposed an early signifier of 'hey, this is gonna be amodule', should the actual module declaration not be first. Hence'module;' was born. (My understanding was that this was driven byimplementors, as they had difficulty entering a module-like mode not atstart of compilation, and indeed it was a little tricky to do that. Ido not know if this was also a user request.)* post p1103, the requirement that everything between 'module;' and themodule decl come from #include came to be.Hope that helps.I know I've mentioned it more than once, but I find it unsettling,given there was great opposition to there being a (two way?) mappingbetween file names and module names, that there is a move in thedirection of making file names 'significant'. ISTM that the desire forbob.$REGULARSUFFIX and alice.$MODULESUFFIX is taking us all the wayback to the first objection above about having two languages.nathanAm 13. April 2022 22:58:13 MESZ schrieb Nicolai Josuttis via Ext<ext@lists.isocpp.org<mailto:ext@lists.isocpp.org>>:What I teach about modules is compelling. Programmers like and want to use it.However, they ask how they should organize module files inpractice.So far I cannot recommend a specific suffix (and I might never be able to dothat).However there is one important question that IMO the standard should answer:*Do we **/need /**different suffixes?*I understand that a suffix discussion is only of practical value.But IMO the standard has to give an answer here (which has nothing to dowith which suffixes are used).Let me elaborate that in detail:Not having a standard suffix has interesting consequences.So far we have header files and translation units.But once we know what a C++ translation unit is, we can just compile themall with the same compiler options or commands. Because in practice we havedifferent suffixes for header and source files, we can set-up generic rulesto compile our code.This works for any suffix, provided you know the way to tell the compilerthat we have a C++ file here:(use /Tp with VC++ and -xc++ with gcc and you are done).Is this still true with modules?That is: Can we expect that identifying a file as C++ file is enough to beable to (pre) compile it as C++ file?Current compilers give different answers (AFAIK):- *gcc *says the same suffix is possible. There is not special option formodules.I can still have my own suffixes and use -xc++ though.- *VC++* currently requires different suffixes or different command-linearguments.Identifying a file as C++ file is not enough.For example- This is not enough: /Tp mymod.cppm- You need: /interface /Tp mymod.cppmI wonder whether the behavior of VC++ is standard conforming.I see no place in the C++ standard saying that there has to be differenttreatment of C++ source files to make them work.Or do we require this somewhere?We do not require different treatment just because we have templates,namespaces, or exceptions used inside.Therefore, I would expect that also using modules does not require specialhandling.(This is independent from the question whether different suffixes help todeal with these files).If I am right, VC++ is not standard conforming.In any case it would help a lot to clarify:Can all C++ source files expect that treating them the same wayworks fine?If not, we obviously need different suffixes. But then we should clearly sayso (without necessarily saying which suffix it is).I hope this questions brings us a bit forward to be able teach the first*portable *"hello, modules" example.ThanksNico
--
PGP/GPG: 2CCB 3ECB 0954 5CD3 B0DB 6AA0 BA03 56A1 2C4638C5
SG15 mailing list
SG15@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg15
SG15 mailing list
SG15@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg15