Repository navigation
Modernization Phase 2.1: modules canary — streamr-eventemitter + streamr-json [iosbuild] - #29
Merged
Merged
Conversation
…es (iosbuild) First C++ named modules in the codebase, in the façade shape from MODERNIZATION.md Part 2: one .cppm partition per public header (header included in the global module fragment, names re-exported via export using), a primary interface unit export-importing the partitions, INTERFACE -> STATIC via streamr_add_module_library(), and the packages' own tests + example flipped from #include to import. - export(TARGETS ... CXX_MODULES_DIRECTORY ...) smoke test passed: the standalone-package export path carries module info. - Downstream find_package + #include consumers build unchanged (GMF facade is ODR-safe as designed). - Root tree: 307/307 tests green; 73 of them now execute through import. - clangd canary better than planned: clangd 22 lints import-using files via the CMake module maps; no lint exclusions needed. .cppm files get clang-format (package lint.sh extended); one clangd-modules quirk (constrained string(string_view) ctor) documented and sidestepped. - Flipped TUs now include what they use (import does not leak transitive std includes). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first C++ named modules in the codebase. Both canary packages now carry the exact façade shape the migration is built on (MODERNIZATION.md Part 2):
.cppmpartition per public header: the header is#included in the partition's global module fragment and its public names are re-exported withexport using. GMF entities stay attached to the global module, which is what makesimportand#includeconsumers ODR-safe to mix during the whole migration.streamr.eventemitter,streamr.json)export imports the partitions — consumers write one import.streamr_add_module_library()(module interface units are compiled TUs).import— 73 of the 307 tests execute through modules. Everything else in the monorepo keeps#includewith zero edits, as designed.Gate results
export(TARGETS … CXX_MODULES_DIRECTORY …)smoke test (standalone/vcpkg path)find_package+#includeconsumer unchanged (streamr-utils standalone)[iosbuild])Findings that shape the next phases
importdoesn't leak transitive std includes the way textual inclusion did — every flipped TU needs to include what it uses (the eventemitter test needed<list>/<tuple>; the example needed<string>). Each package flip will carry a small include-adding pass. A good hygiene side effect.std::string(std::string_view)constructor template isn't resolved in import-using files (the compiler is fine with it; plain constructors work). Sidestepped in the example with the pass-by-value idiom; documented in MODERNIZATION.md as a watch-item..cppmgets clang-format only (canary packages'lint.shextended); headers remain the fully linted source of truth until consolidation.Next
Phase 2.2: streamr-logger + streamr-utils — folly enters the global module fragment for the first time, and utils is the folly::coro coroutine canary.
🤖 Generated with Claude Code