On 08/31/2018 03:09 PM, Ben Craig wrote:
Maybe it's too soon for this, but can I see a Tony table for the build process? I can even start...
I think that might be useful and I can produce something like that. I think what might be more informative though is inclusion of examples for tools that don't (can't) use the typical compiler and build system approach. I'll try and add that too.
| Implementation |
Header style |
Module style |
| // foo.h #include <foo/detail.h> ... void foo(); ... // foo.cpp void foo() { ... } // t.cpp #include <foo.h> int main() { foo(); } |
// foo.cpp module; #include <foo/detail.h> export module foo; ... export void foo() { ... } ... // t.cpp import foo; int main() { foo(); } |
|
| Microsoft |
$ cl /Ifoo/include t.cpp foo.lib /Fet.exe |
$ cl /experimental:module
/module:interface /c /Ifoo/include foo.cpp
# generates foo.ifc $ cl /experimental:module /module:reference m.ifc t.cpp foo.lib /Fet.exe |
| Clang |
$ clang -Ifoo/include t.cpp
-lfoo -o t |
$ clang -fmodules-ts --precompile -Ifoo/include
foo.cpp -o foo.pcm #
generates foo.pcm $ clang -fmodules-ts -fmodule-file=foo.pcm t.cpp -lfoo -o t |
| Gcc |
$ gcc -Ifoo/include t.cpp -lfoo -o t |
$ gcc -fmodules-ts -c Ifoo/include
foo.cpp # generates
foo.nms (and unused foo.o) $ gcc -fmodules-ts t.cpp -lfoo -o t # implicitly searches for foo.nms |
| Hypothetical minimal module description
file (module.desc) |
| [ { "module" : "foo", "source" : "foo.cpp", "include_paths" : [ "foo/include", ], }, ] |
| Implementor | Module style with module description file |
| Microsoft | $ cl /experimental:module /module:desc module.desc
t.cpp foo.lib /FEt.exe |
| Clang | $ clang -fmodules-ts -fmodule-desc
module.desc t.cpp -lfoo -o t |
| Gcc | $ gcc -fmodules-ts
-fmodule-desc module.desc t.cpp -lfoo -o
t |
Code in question...
* Before
#include <iostream>
int main() {std::cout<<"Hello World\n";}
* After
import std.io
int main() {std::cout<<"Hello World\n";}
Minimal build process before...
* MSVC
vcvars64.bat
cl /EHs HelloWorld.cpp
HelloWorld.exe
* GCC
g++ HelloWorld.cpp
./a.out
* Clang
clang HelloWorld.cpp
./a.out
Minimal build process after...
???
-----Original Message-----_______________________________________________
From: Ext <ext-bounces@lists.isocpp.org> On Behalf Of Tom Honermann
Sent: Friday, August 31, 2018 1:44 PM
To: Nathan Sidwell <nathan@acm.org>; Evolution Working Group mailing list
<ext@lists.isocpp.org>; WG21 Tooling Study Group SG15 <tooling@open-
std.org>
Cc: C++ Library Evolution Working Group <lib-ext@lists.isocpp.org>
Subject: Re: [Ext] [Tooling] Modules and tooling: Resolving module import
declarations
On 08/31/2018 01:25 PM, Nathan Sidwell wrote:
On 08/31/2018 12:05 PM, Tom Honermann wrote:3F&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSj
Are you referring to the module mapper approach documented at
https://urldefense.proofpoint.com/v2/url?u=https-3A__gcc.gnu.org_wiki
_cxx-2Dmodules-
NTLuokE8b6KUixA&r=y8mub81SfUi-UCZRX0Vl1g&m=b-ZgaER9j5-_3U9ipw-k24_LU-
The fact that documentation for an experimental feature exists at all raisesTg86Q&s=i5HfnVg5UjXCB7L7-dyAGSUS4WOGA26soB1m2mk6gRQ&e=That documentation is pretty opaque. I can only blame myself.
you well above the level at which criticism is justified ;)
Indeed, I can - and would like to if this discussion reveals an approach thatIf so, my concern with that approach is that it effectively requiresThe defaults it has right now may not be the best defaults. (Hey, you
a build system. Perhaps the default module mapper does not (I'm not
sure exactly what it does at present. My brief tests indicate it
requires a
can go experiment with better defaults!)
might have broad agreement.
I'm lobbying for a position in which the default behavior is, if no suitable
module artifact is identified, identify the module interface unit source code
and translate it (produce and discard a module artifact if useful; or not). And
I'm looking for the answers to "where is the module interface unit source"
and "how do I translate it" to be available in some industry standard tool
agnostic form that doesn't require a running build invocation (but can
depend on a prior (partial) build).
Tom.
_______________________________________________
Ext mailing list
Ext@lists.isocpp.org
Subscription: https://urldefense.proofpoint.com/v2/url?u=http-
3A__lists.isocpp.org_mailman_listinfo.cgi_ext&d=DwIGaQ&c=I_0YwoKy7z5L
MTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=b-
ZgaER9j5-_3U9ipw-k24_LU-
NTLuokE8b6KUTg86Q&s=wCdzzdGNbO34zKR_3LjCRsXdJkJqhmj9EM_xNrQ1y
4k&e=
Link to this post: https://urldefense.proofpoint.com/v2/url?u=http-
3A__lists.isocpp.org_ext_2018_08_5718.php&d=DwIGaQ&c=I_0YwoKy7z5L
MTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=b-
ZgaER9j5-_3U9ipw-k24_LU-
NTLuokE8b6KUTg86Q&s=qSsZRHLeU9jVHHSr0tACq_IQ9Jl6aL_o9niC9twsUmE
&e=
Ext mailing list
Ext@lists.isocpp.org
Subscription: http://lists.isocpp.org/mailman/listinfo.cgi/ext
Link to this post: http://lists.isocpp.org/ext/2018/08/5720.php
_______________________________________________
Ext mailing list
Ext@lists.isocpp.org
Subscription: http://lists.isocpp.org/mailman/listinfo.cgi/ext
Link to this post: http://lists.isocpp.org/ext/2018/08/5723.php