What is the difference between module partitions and submodules?

I have a module called math that export imports two submodules like this:


1
2
3
4
export module math;

export import math.one;
export import math.two;


I also have a module called mathPartition that exports imports two partitions like this:

1
2
3
4
export module mathPartition;

export import :math1;
export import :math2;


What is the difference between using submodules and using partitions?
Can they be used to deal with cyclic dependencies?

Last edited on
How about having two modules that depend on each other, but only parts of each other?
Say one part of math (call it math.one) depends on one part of text (call it text.two) and this part of text depends on another part of math called math.two. Math.two can depend on another part of text (call it text.one).


There is no cycle! and yet the 2 modules depend on different parts of each other... actually math.one could depend also on text.one and not produce a cycle.
So the submodule math.one can depend on the whole module text but only part of this text (text.two) depends on a part of module math (math.two). We have no cycles!!
https://www.studyplan.dev/pro-cpp/modules

The notion of a submodule is not an official part of the language, but it is something that is adopted by the community.

See also:

https://stackoverflow.com/questions/70762898/c-20-modules-submodul-vs-modulpartition-diffrence

It's amazing what spending a bit of time using an internet search engine can do:

https://duckduckgo.com/?t=ffab&q=c%2B%2B+module+partitions+vs.+submodules&atb=v188-1&ia=web
Don’t be too harsh. The internet is a scary mistress when coding, and JUANDENT has learned that we tend to work through the weirder stuff he comes across with a bit of focus.

I haven’t touched modules yet. (I’m still living in C++17 land.) So I cannot say anything useful, alas.
I haven’t touched modules yet.

I'm working through some of the basics of modules, and the differences between using headers and modules.

A work-in-progress GitHub of my testing so far:
https://github.com/GeorgePimpleton/module_testing
Topic archived. No new replies allowed.