Result Roadmap

This page summarizes the current and planned capabilities for the Result abstraction. The authoritative, most granular source is the repository root file ResultFeatures.md. This page is updated periodically and focuses on high‑signal planning items.

Legend

βœ… Implemented Β· πŸ”„ In Progress Β· ⭐ High Priority (next 1–2 milestones) Β· πŸ“‹ Planned Β· πŸ€” Considering

Phase Overview

  1. Foundation (βœ… complete)
  2. Core Expansion & Error Model (βœ… complete)
  3. Inspection & Value Access (πŸ”„ ToString enrichment in progress)
  4. Async Parity & Composition Refinement (⭐ upcoming: TapErrorAsync, MapErrorAsync, MapErrors, TapBoth)
  5. Collections & Aggregation Enhancements (πŸ“‹ error grouping, merge helpers)
  6. Interop & Language Integration (πŸ“‹ factory helpers, implicit success lift)
  7. Resilience & Policies (πŸ“‹ retry, timeout)
  8. Performance & Memory (πŸ“‹ struct variant, shared success instances)
  9. Domain & Tooling Extensions (πŸ“‹ analyzers, source generation)
  10. Documentation, Testing & Benchmarks (πŸ“‹ debugger display, cookbook, benchmarks)

Recently Completed Highlights

  • Structured reason model (IReason, IError, ISuccess) with result-level and reason-level metadata
  • Domain error records: NotFound, Validation, Conflict, Unauthorized, Exceptional, SuccessReason
  • Enrichment helpers: WithSuccess, WithError, WithErrors, WithMetadata (dictionary / single / params tuple)
  • Multi-arity results with generated introspection helpers (ToNullable, TryGet, deconstruction)
  • Core functional operators (Bind, Map, Ensure, Try, Tap, TapError) + async counterparts

Active / Next (Short Horizon)

Item Status Notes
Value-fold Match<TOut> ⭐ Complete symmetry with action-based Match
ToString enrichment πŸ”„ Add first error code + compact metadata preview
Error wrapping helper πŸ“‹ Map Exception β†’ domain error record
Prepend/Append error transformers πŸ“‹ Message shaping utilities
EnsureNotNull / EnsureNotEmpty πŸ“‹ Convenience validation errors (ValidationError)

Async Parity (Upcoming Batch)

Item Status Goal
TapErrorAsync ⭐ Observe async side-effects on failure
MapErrorAsync ⭐ Normalize async error transformation
MapErrors ⭐ Batch transform aggregated errors (future multi-error support)
TapBoth / TapEither ⭐ Symmetric observation for success/failure branches
BindTryAsync πŸ“‹ Async factory with exception capture

Aggregation & Analysis (Planned)

Feature Status Purpose
Errors() / AllErrors() ⭐ Enumerate error reasons directly
Merge ⭐ Combine maintaining success reasons & union of error metadata
GroupByErrorCode ⭐ Quick diagnostics / reporting
SummarizeErrors πŸ“‹ Human-readable aggregated summary

Interop & Language Integration

Feature Status Purpose
FromNullable / FromCondition ⭐ Lift conventional patterns into Result
FromValidation πŸ“‹ Bridge validation libraries
Implicit success lift (T β†’ Result) ⭐ Reduce ceremony in pipelines
ASP.NET Core mappers πŸ“‹ Map Result β†’ standardized HTTP responses
ToOption / FromOption πŸ“‹ Interoperate with Option type

Resilience & Performance (Longer Horizon)

Feature Status Purpose
Retry / Timeout policies ⭐ Declarative execution wrappers returning Result
Struct Result variant πŸ“‹ Allocation reduction for hot paths
Shared success instances πŸ“‹ Reuse zero-alloc sentinel successes
Lazy exception creation πŸ“‹ Defer cost until inspected

Tooling & DX

Feature Status Purpose
Analyzer: ignored Result ⭐ Warn on discarded results
Analyzer: chain simplification ⭐ Suggest Bind/Ensure improvements
Domain error source generator πŸ“‹ Scaffold boilerplate error records
Debugger Display πŸ“‹ Rich summary in debugger views
Cookbook & Migration Guides πŸ“‹ Adoption & onboarding

Design Tenets

  • Composability first, side-effects explicit
  • Rich, structured errors (codes + metadata) without forcing heavy frameworks
  • Parity between sync and async to avoid ergonomic drift
  • Source generation for advanced introspection & multi-arity to keep runtime lean
  • Opt-in performance modes (struct variant) after API surface stabilizes

Open Questions (Tracking)

  1. Should implicit conversions be always-on or opt-in via a using directive? (Ergonomics vs surprise conversions)
  2. Error propagation policy for metadata collisions (currently: last write wins). Need documented policy & maybe strategy enum.
  3. Formatting contract for ToString / DebuggerDisplay (deterministic key ordering? truncation rules?)
  4. Scope of multi-error aggregation vs single primary error (how deep do we go before complexity hurts usability?)

Contributing

Issues / PRs welcome. When proposing a new operator, outline:

  • Category (Transformation / Inspection / Composition / Interop)
  • Sync/Async symmetry plan
  • Overload shape and naming rationale
  • Interaction with existing operators (e.g., precedence with Ensure / MapError)

Full Detail

For exhaustive status (including exploratory backlog) see the repository root: ResultFeatures.md.


Last updated: 2025-10-02