Skip to content

API/Reflection: no public custom-reflection / wrapper-peeling traits forces duplicate has_reflection_method and RemoveReflection machinery #190

Not planned

Description

@clockblocker

Part of #138
Popularity: 1/7 corpus consumers (sqlgen)

Related issues

Related to #92 (Prototype unified wrapper composition, recursive trait peeling, and deep-unwrap, closed as out-of-scope for a broad wrapper rewrite) and #147 (wrapper boilerplate); however, exposing read-only public reflection-protocol traits is much narrower in scope than a full wrapper rewrite.

Problem

reflect-cpp's custom-type reflection protocol (T::ReflectionType + .reflection() and external rfl::Reflector<T> specializations) is checked internally via private rfl::internal::* traits (has_reflection_type_v, has_reflection_method_v, has_read_reflector, has_write_reflector, etc.), with no public traits or concepts for downstream libraries building their own schema/query/serialization layers on top of reflect-cpp.

Consequently, downstream consumers that want to honor reflect-cpp's custom-type and wrapper types (rfl::Pattern, rfl::Email, rfl::Timestamp, rfl::UUIDv*, sqlgen::PrimaryKey, sqlgen::ForeignKey, sqlgen::Unique, sqlgen::Varchar, etc.) must:

  1. Re-invent their own has_reflection_method concept and recursive RemoveReflection / is_nullable peeling traits;
  2. Hard-code stop-recursion exceptions for reflect-cpp semantic wrappers like rfl::Timestamp<_format> (which exposes ReflectionType = std::string); and
  3. Often miss external rfl::Reflector<T> specializations altogether, forcing users to write redundant specializations for both rfl::Reflector<T> and the downstream library's own traits.

Observed Downstream Workaround

munich-data-engineering/sqlgen (265b0a17)

Root Cause in reflect-cpp & Suggested Direction

reflect-cpp's reflection-protocol detection traits (has_reflection_type_v, has_reflection_method_v, has_read_reflector, has_write_reflector) are confined to rfl::internal::. Exposing a small, read-only public traits header (e.g., rfl::has_reflection_method_v<T>, rfl::has_reflector_v<T>, rfl::reflection_type_t<T>) would let downstream libraries cleanly support both .reflection() types and rfl::Reflector<T> specializations without duplicating internal detection logic.

Upstream Overlap

Activity

  1. added
    enhancement
    needs-triage
    known-downstream-workarounds
    on Nov 29, 2026
  2. added
    wontfix
    and removed
    needs-triage
    on Nov 29, 2026
  3. clockblocker commented on Nov 29, 2026

    @clockblocker
    OwnerAuthor

    Triage decision: closing as wontfix (not planned) for the upstream adoption track.

    Rationale: sqlgen-only custom-reflection / wrapper-peeling traits (has_reflection_method / RemoveReflection). sqlgen is authored by reflect-cpp's own maintainer; if wanted in rfl, he can promote it directly. Zero external adoption leverage.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementknown-downstream-workaroundswontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions