Skip to content

Consolidate Result<T> headers for C++20 module preparation#257

Merged
kcenon merged 5 commits into
mainfrom
refactor/consolidate-result-headers
Jan 1, 2026
Merged

Consolidate Result<T> headers for C++20 module preparation#257
kcenon merged 5 commits into
mainfrom
refactor/consolidate-result-headers

Conversation

@kcenon

@kcenon kcenon commented Jan 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Consolidate 8 Result headers into 3 logical groups
  • Prepare for C++20 module migration
  • Follow Kent Beck's "Fewest Elements" principle

Changes

New Consolidated Headers

Header Contents
result/core.h Forward declarations, error_info, Result, Optional
result/utilities.h Factory functions, exception conversion, macros
result/compat.h Legacy error code aliases

Deprecated Headers

Individual headers now emit deprecation warnings:

  • fwd.h, error_info.h, result_core.h, optional.h -> core.h
  • result_funcs.h, exception_conversion.h, result_macros.h -> utilities.h
  • error_codes_compat.h -> compat.h

Migration Path

// Still works (umbrella header)
#include <kcenon/common/patterns/result.h>

// New consolidated includes
#include <kcenon/common/patterns/result/core.h>
#include <kcenon/common/patterns/result/utilities.h>

Metrics

Metric Before After
Header files 8 3
Include depth 8 2
Module partitions unclear 3 clear

Test Plan

  • All 108 tests pass
  • Build completes without errors
  • Deprecation warnings appear for old headers
  • No deprecation warnings in main codebase

Documentation

  • Updated DEPRECATION.md with migration guide
  • Updated CHANGELOG.md with change summary

Closes #255

kcenon added 5 commits January 2, 2026 07:20
Create three new consolidated headers following Kent Beck's
"Fewest Elements" principle:

- core.h: Combines fwd, error_info, result_core, and optional
- utilities.h: Combines result_funcs, exception_conversion, and macros
- compat.h: Contains error codes compatibility layer

This reduces header count from 9 to 3 logical files, preparing
for future C++20 module migration.

Refs: #255
Update result.h to include new consolidated headers (core.h,
utilities.h, compat.h) instead of individual headers.

This maintains backward compatibility while simplifying
the include structure.

Refs: #255
Add deprecation warnings to old individual headers:
- fwd.h -> core.h
- error_info.h -> core.h
- result_core.h -> core.h
- optional.h -> core.h
- result_funcs.h -> utilities.h
- exception_conversion.h -> utilities.h
- result_macros.h -> utilities.h
- error_codes_compat.h -> compat.h

Headers still work but emit compiler warnings directing users
to the new consolidated headers. Original content preserved
for reference within #if 0 blocks.

Refs: #255
Replace deprecated fwd.h include with core.h in callable.h
to eliminate deprecation warnings.

Refs: #255
Update DEPRECATION.md with:
- New section for deprecated individual Result headers
- Migration guide from 8 headers to 3 consolidated headers
- Future C++20 module structure information

Update CHANGELOG.md with:
- Consolidated headers change entry
- Deprecation section for individual headers

Refs: #255
@kcenon kcenon merged commit f4c2e80 into main Jan 1, 2026
22 checks passed
@kcenon kcenon deleted the refactor/consolidate-result-headers branch January 1, 2026 22:41
kcenon added a commit that referenced this pull request Apr 13, 2026
* feat(result): add consolidated headers for C++20 module preparation

Create three new consolidated headers following Kent Beck's
"Fewest Elements" principle:

- core.h: Combines fwd, error_info, result_core, and optional
- utilities.h: Combines result_funcs, exception_conversion, and macros
- compat.h: Contains error codes compatibility layer

This reduces header count from 9 to 3 logical files, preparing
for future C++20 module migration.

Refs: #255

* refactor(result): update umbrella header to use consolidated headers

Update result.h to include new consolidated headers (core.h,
utilities.h, compat.h) instead of individual headers.

This maintains backward compatibility while simplifying
the include structure.

Refs: #255

* refactor(result): deprecate individual headers with pragma message

Add deprecation warnings to old individual headers:
- fwd.h -> core.h
- error_info.h -> core.h
- result_core.h -> core.h
- optional.h -> core.h
- result_funcs.h -> utilities.h
- exception_conversion.h -> utilities.h
- result_macros.h -> utilities.h
- error_codes_compat.h -> compat.h

Headers still work but emit compiler warnings directing users
to the new consolidated headers. Original content preserved
for reference within #if 0 blocks.

Refs: #255

* refactor(concepts): update callable.h to use core.h

Replace deprecated fwd.h include with core.h in callable.h
to eliminate deprecation warnings.

Refs: #255

* docs: add Result<T> header consolidation to documentation

Update DEPRECATION.md with:
- New section for deprecated individual Result headers
- Migration guide from 8 headers to 3 consolidated headers
- Future C++20 module structure information

Update CHANGELOG.md with:
- Consolidated headers change entry
- Deprecation section for individual headers

Refs: #255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] Consolidate Result<T> headers from 9 to 3 - C++20 Module preparation

1 participant