Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

API/Reflection: no public constexpr std::string_view type-name API (forces rfl::internal::get_type_name_str_view) #145

Backlog

Description

@clockblocker

Part of #138
Popularity: 2/7 corpus consumers (cuda-quantum, sqlgen)

Problem

reflect-cpp only exposes rfl::type_name_t<T>() (an rfl::Literal<StringLiteral> type) in its public API while keeping rfl::internal::get_type_name_str_view<T>() inside an internal header (<rfl/internal/get_type_name.hpp>). Consumers building compile-time bindings (e.g. nanobind nb::detail::descr<N> type descriptions) or compile-time SQL/schema identifier validation (static_assert length checks, namespace stripping, identifier sanitization) either reach into rfl::internal::get_type_name_str_view, copy-paste the compiler-specific <source_location>/__FUNCSIG__/__PRETTY_FUNCTION__ parser verbatim, or write extra wrapper traits to unpack rfl::type_name_t<T>.

Observed Downstream Workarounds

NVIDIA/cuda-quantum (90e4aa08)

  • cudaq/lib/Target/Reflection.h#L17-L32: includes <rfl/internal/get_type_name.hpp> directly and explicitly comments on the fragility of relying on an internal API:
    #include <rfl/internal/get_type_name.hpp>
    ...
    /// The fully qualified name of `T`, e.g. `cudaq::config::Codegen`.
    // Unfortunately, this has to use a private API of reflect-cpp. If this turns
    // out to be brittle, we could roll our own implementation.
    template <typename T>
    constexpr std::string_view qualifiedName =
        rfl::internal::get_type_name_str_view<T>();
  • cudaq/lib/Target/python/CompileTargetCaster.cpp#L60-L63: expands the constexpr std::string_view character-by-character into nanobind's compile-time nb::detail::descr:
    template <typename T>
    constexpr auto typeDescr = []<std::size_t... I>(std::index_sequence<I...>) {
      return nb::detail::descr<sizeof...(I)>(typeName<T>[I]...);
    }(std::make_index_sequence<typeName<T>.size()>());

munich-data-engineering/sqlgen (265b0a17)

Related Fork Work

Upstream Overlap

Activity

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

    @clockblocker
    OwnerAuthor

    Tracking & PR Cross-Reference

    Status: Fully addressed in upstream-queue (Draft PR #191).

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-workaroundsneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions