<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">The page for modules (<a href="http://clang.llvm.org/docs/Modules.html#future-directions">http://clang.llvm.org/docs/Modules.html#future-directions</a>) mentions in the future directions section enhancing modularize with an assistant mode
 for generating a module.map file.  I’m starting to think about that, so I wanted to open up a discussion for ideas and feedback, particularly since modules are new, and I might not have the correct understanding about them yet.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">First off, do you think having modularize optionally generate a module.map file is even warranted?  If it is, how close can we get to producing a useable module.map file?  But perhaps the idea is just to create a starting point, to save
 some typing, since we would already have a list of header files.  I’ll proceed along those lines.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Basically, as a starting point, I assume the header file name list is the basis for the headers included in the modules, except that these headers can still include other headers via #include, and are not listed because they are either
 internal, or they are part of a group but not independent and should not result in a separate submodule.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Then at this point, that raises the question of how you figure out the module/submodule hierarchy.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The simplest scheme is that all the files in the header file list pertain to just one outer module, named by a command-line option.  For example, “-root=std” would define one outer module called “std” and each header in the header file
 list would be a submodule inside “std”.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The header file list might have headers that are in subdirectories.  Perhaps a modification of the above scheme could be that a submodule is created for the subdirectory name, and the headers in the subdirectory go inside that module, becoming
 sub-sub-modules and so on.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As an alternative, perhaps namespace blocks could be used to determine modules.  The outermost namespace determines the root module, and nested namespaces become the submodule hierarchy.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This raises the question of what to do about global definitions.  Perhaps we could still use the -root=name option, but if the outer namespace uses that name, it’s effectively ignored, so the hierarchy is still as expected.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This also raises the question of file boundaries themselves.  If multiple files are in a single leaf namespace, are they ignored with respect to becoming separate submodules, or do they still become submodules within the module for the
 leaf namespace?  (Can a “module” statement have multiple “header” statements in the module.map language?)  Perhaps if the namespace only occurs in the one file, it results in just one module.  But if the  leaf namespace is used in multiple files, the files
 become submodules with respect to the module created for the leaf namespace.  This might be pretty difficult to figure out.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If we needed options for module map output per header file, the header file list format might be extended with ‘-‘ options, but perhaps that’s taking it too far, as we don’t want the header list complexity to start approaching that of the
 module.map.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Anyway, these are the ideas and questions that came to my mind.  What do you think?  Is there more that could be done to bring the output module.map file closer to what’s needed without making it too complicated?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-John<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>