Skip to content

chore - Replace RFC 101 OrdinalKey bridge with RFC 098/099 trait-owned capability support #596

@dannymeijer

Description

@dannymeijer

Area

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Runtime / Core crates (stdlib/core/derive)

Summary

RFC 101 (std.collections.OrdinalMap) is implemented for v0.3, including the deterministic OrdinalKey surface and benchmarked lookup behavior. The v0.3 implementation deliberately carries a narrow Rust/compiler bridge for deterministic scalar key conformance because RFC 098 and RFC 099 are not in scope until v0.5.

This chore tracks paying down that bridge once the v0.5 trait-system work lands. It is blocked by:

The goal is not to reopen RFC 101. The goal is to keep RFC 101's public behavior and performance while moving the remaining bridge into the proper Incan trait-system model.

Scope

  • In scope:
    • Model OrdinalKey scalar conformance through the RFC 098/099 trait-owned capability-family machinery.
    • Preserve deterministic key support for strings, bytes, booleans, exact-width integers, decimal, UUID, civil date/time values, fixed-offset datetimes, and stable scalar value enums.
    • Remove or collapse the RFC 101-specific compiler bridge once the generic conformance mechanism can express the same facts.
    • Keep the std.collections.OrdinalMap public API and serialization contract stable.
    • Preserve the benchmark shape established by RFC 101, especially exact lookup and batch lookup behavior.
  • Out of scope:
    • Changing OrdinalMap semantics or making unchecked lookup the default.
    • Adding float key support; float determinism remains a separate policy question.
    • Replacing OrdinalMap with a general physical database index abstraction.
  • Risks:
    • The generic trait-system implementation must not regress the fast str/bytes lookup paths.
    • Capability-family coherence must remain deterministic: a concrete type can have only one visible OrdinalKey conformance.

Plan

  1. Land the RFC 098 associated-type model needed by trait-owned capability metadata.
  2. Land the RFC 099 generic trait-targeted method and trait-owned capability-family model.
  3. Re-express the OrdinalKey deterministic scalar family through that model instead of RFC 101-specific compiler logic.
  4. Remove the temporary bridge from the compiler/backend paths once equivalent source/metadata-driven conformance exists.
  5. Re-run the RFC 101 benchmark suite at 1M keys/probes against Python dict, fastconstmap, and Incan OrdinalMap.
  6. Update RFC 101's implementation notes if any bridge code remains intentionally generic infrastructure rather than feature-specific debt.

Done when

  • RFC 098 and RFC 099 are implemented sufficiently for OrdinalKey scalar conformance to be expressed through the normal trait-system path.
  • RFC 101-specific bridge logic is removed or replaced by generic trait capability-family infrastructure.
  • OrdinalMap API, deterministic serialization, exact safe lookup, unchecked lookup, batch lookup, and supported key matrix continue to pass tests.
  • Benchmarks remain credible against the RFC 101 baseline, with any regression explained and accepted explicitly.
  • Documentation no longer describes the v0.3 bridge as active debt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    incan compilerSuggestions, features, or bugs related to the Compiler (frontend/backend/codegen)incan language semanticsSuggestions, features, or bugs related to the Incan Language itself (syntax and semantics)runtime / core cratesSuggestions, features, or bugs related to the `incan-core`, `incan-stdlib`, 'incan-derive` crates

    Type

    No fields configured for Chore.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions