Topic: pre toronto mailing modules proposal


Author: gmisocpp@gmail.com
Date: Thu, 29 Jun 2017 05:57:15 -0700 (PDT)
Raw View
------=_Part_3417_724499250.1498741035230
Content-Type: multipart/alternative;
 boundary="----=_Part_3418_664593500.1498741035230"

------=_Part_3418_664593500.1498741035230
Content-Type: text/plain; charset="UTF-8"

Hello Everyone

I'm trying to follow the module proposals and the latest suggestions
regarding them from the pre Toronto mailing.

Could somebody please clarify how the latest modules proposal suggests
we define a module?

Is it like this:

To create and use a module one needs to have a module interface and it's
implementation,

A module interface for a module named x can be defined by a single file
containing a module x [[interface]] statement;
OR
A module interface can be defined by a group of files where each file
contains a module x [[partition]] statement';

In the module definition file, they just announce the source that
follows defines the module x by doing simply: module x;

So if someone was going to define the STL via modules, they might do:

// file: std_containers.vector.h
module std_containers [[partition]]
class vector { /* ... */ };

// file: std_containers.string.h
module std_containers [[partition]]
class string { /*...*/ }

// file:std_containers.vector.cpp
module std_containers;
vector::vector() { }

// file: std_containers.string.cpp
string::string() { }


// file: std_filesystem.h
module std_filesystem [[interface]]
class path { /* ... */ };
bool some_helper();

// file: std_filesystem.cpp

export path::path() { }
export bool some_helper();

// Then the user might use some compiler to compile like so:
$ cc std_containers.cpp std_filesystem.cpp

To create these files:
std_containers.module_interface
std_filesystem.module_interface
std_containers.module_implementation; // could be a dll or so file or lib
std_filesystem.module_implementation; // could be a dll or so file or lib

Then they might create a user of this module like so:
module_client.cpp
import std_containers; // now string and vector exist
import std_filesystem; // now path exists.

// And compile it with some compiler
cc module_client.cpp -module_interface std_containers.module_interface
std_filesystem.module_interface

My questions are:
1. Is this a valid description of how this is expected to work regarding
source code layout and content?

2. When compiling a module named x from a set of files I assume a 'module x
[[interface]]' statement can only appear in one of those files?
3. But a  'module x [[partition]]' can appear in multiple files.

4. But can a single file contain multiple module id [[interface]]
statements and can the same id name appear more than once in that file;
i.e. can the user try to define multiple module interfaces or modules from
a single file.

5. Same question for module id [[partition]]

6. I tried this with the MS 2017 compiler and I didn't get anywhere but I
assume this is because the compiler doesn't implement what is proposed
above yet because the Toronto meeting hasn't agreed this yet. Is that
correct?

7. The paper suggests attributes for [[partition]] and [[interface]]. Why
attributes?
Is this to avoid introducing keywords? Users would not really appreciate
using attributes here?
I assume this is known.
Searching for all module X elements by just doing a literal search on
"module X" seems appealing though.

That's my questions, thanks.
GM


--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5d9edee7-e709-467f-bb9f-9001d5e2a421%40isocpp.org.

------=_Part_3418_664593500.1498741035230
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello Everyone</div><div><br></div><div>I&#39;m tryin=
g to follow the module proposals and the latest suggestions regarding them =
from the pre Toronto mailing.</div><div><br>Could somebody please clarify h=
ow the latest modules proposal=C2=A0suggests we=C2=A0define a module?</div>=
<div><br></div><div>Is it like this:</div><div><br></div><div>To create and=
 use a=C2=A0module one needs to have a module=C2=A0interface and it&#39;s i=
mplementation,</div><div><br></div><div>A module interface for a module nam=
ed x can be=C2=A0defined by a single file containing a=C2=A0module=C2=A0x [=
[interface]] statement;<br>OR</div><div>A module=C2=A0interface=C2=A0can=C2=
=A0be defined by=C2=A0a group of files=C2=A0where each file contains=C2=A0a=
=C2=A0module=C2=A0x [[partition]] statement&#39;;</div><div><br></div><div>=
In the module definition=C2=A0file, they just announce the source that foll=
ows=C2=A0defines the module x by doing simply: module x;</div><div><br></di=
v><div>So if someone was going to define the=C2=A0STL via modules, they mig=
ht do:</div><div><br></div><p>// file: std_containers.vector.h<br>module st=
d_containers [[partition]]<br>class vector { /* ... */ };</p><div><br></div=
><div>// file: std_containers.string.h<br>module std_containers [[partition=
]]<br>class string { /*...*/ }</div><div><br></div><div>// file:std_contain=
ers.vector.cpp<br>module std_containers;<br>vector::vector() { }<br></div><=
div><br></div><div>// file: std_containers.string.cpp<br>string::string() {=
 }</div><p><br>// file: std_filesystem.h<br>module std_filesystem [[interfa=
ce]]<br>class path { /* ... */ };<br>bool some_helper();</p><div><br></div>=
<div>// file: std_filesystem.cpp</div><p>export path::path() { }<br>export =
bool some_helper();</p><div><br></div><div>// Then the user might use some =
compiler to compile like so:<br>$ cc std_containers.cpp std_filesystem.cpp<=
/div><div><br></div><div>To create=C2=A0these files:</div><div>std_containe=
rs.module_interface</div><div>std_filesystem.module_interface</div><div>std=
_containers.module_implementation; // could be a dll or so file or lib</div=
><div>std_filesystem.module_implementation; // could be a dll or so file or=
 lib</div><div><br></div><div>Then they=C2=A0might create a user of this=C2=
=A0module like so:</div><div>module_client.cpp</div><div>import std_contain=
ers; // now string and vector exist</div><div>import std_filesystem; // now=
 path exists.</div><div><br></div><div>// And compile it with some compiler=
</div><div>cc module_client.cpp -module_interface std_containers.module_int=
erface std_filesystem.module_interface</div><div><br></div><div>My question=
s are:</div><div>1. Is this a valid description of how=C2=A0this=C2=A0is ex=
pected to work regarding source code layout and content?</div><div><br></di=
v><div>2. When compiling=C2=A0a module named x from a set of files=C2=A0I a=
ssume=C2=A0a &#39;module x [[interface]]&#39;=C2=A0statement=C2=A0can only =
appear in one of those files?</div><div>3.=C2=A0But a =C2=A0&#39;module=C2=
=A0x=C2=A0[[partition]]&#39; can appear in multiple files.</div><div><br></=
div><div>4. But can a single file contain multiple module=C2=A0id [[interfa=
ce]] statements and can the same id name appear=C2=A0more than once=C2=A0in=
 that file;</div><div>i.e. can the user try to define multiple module inter=
faces or modules from a single file.</div><div><br></div><div>5. Same quest=
ion for module id [[partition]]</div><div><br></div><div>6. I tried this wi=
th the MS 2017 compiler and I didn&#39;t get anywhere but I assume this is =
because the compiler doesn&#39;t implement=C2=A0what is proposed above yet=
=C2=A0because=C2=A0the Toronto meeting hasn&#39;t agreed this yet. Is that =
correct?</div><div><br></div><div>7. The paper suggests attributes for [[pa=
rtition]] and [[interface]]. Why attributes?</div><div>Is this to avoid int=
roducing keywords?=C2=A0Users=C2=A0would not really appreciate using attrib=
utes here?</div><div>I assume this is known.</div><div>Searching for all mo=
dule X elements=C2=A0by just doing a literal search on &quot;module X&quot;=
 seems appealing though.</div><div><br></div><div>That&#39;s my questions, =
thanks.</div><div>GM</div><div><br></div><div><br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5d9edee7-e709-467f-bb9f-9001d5e2a421%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5d9edee7-e709-467f-bb9f-9001d5e2a421=
%40isocpp.org</a>.<br />

------=_Part_3418_664593500.1498741035230--

------=_Part_3417_724499250.1498741035230--

.