Skip to content

API/Naming: missing CamelCaseToKebabCase processor and non-reusable field-name transforms for rfl::to_view reflection #149

Not planned

Description

@clockblocker

Part of #138
Popularity: 1/7 corpus consumers (cuda-quantum)

Problem

  1. reflect-cpp (v0.25.0) provides rfl::CamelCaseToSnakeCase and rfl::SnakeCaseToKebabCase, but no direct rfl::CamelCaseToKebabCase processor—so C++ camelCase structs serialized to kebab-case YAML/JSON must chain both processors manually.
  2. Field-name case-conversion utilities are tightly coupled to serializer/deserializer processors (rfl::Processors<...>) and are not exposed as reusable constexpr/runtime helpers for direct reflection consumers using rfl::to_view. Furthermore, standard naive camelCase -> snake_case splitting often mishandles acronyms (e.g. eraseQEC -> erase_qec rather than erase_q_e_c), forcing reflection-based binding layers (like Python nanobind casters) to hand-roll their own case converter.

Observed Downstream Workarounds

NVIDIA/cuda-quantum (90e4aa08)

  • cudaq/lib/Target/Yaml/TargetConfigYamlAdapters.h#L21-L23: chains two processors to achieve camelCase -> kebab-case:
    using YamlProcessors =
        rfl::Processors<rfl::CamelCaseToSnakeCase, rfl::SnakeCaseToKebabCase,
                        rfl::NoExtraFields>;
  • cudaq/lib/Target/python/CompileTargetCaster.cpp#L31-L43: hand-rolls an acronym-aware pythonName(std::string_view) helper on top of rfl::to_view field iteration (forEachField):
    /// The Python name of the C++ field `name`: `eraseQEC` becomes `erase_qec`.
    std::string pythonName(std::string_view name) {
      std::string snake;
      for (std::size_t i = 0; i < name.size(); ++i) {
        bool wordStart = i > 0 && std::isupper(name[i]) &&
                         (std::islower(name[i - 1]) ||
                          (i + 1 < name.size() && std::islower(name[i + 1])));
        if (wordStart)
          snake += '_';
        snake += std::tolower(name[i]);
      }
      return snake;
    }

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: CamelCaseToKebabCase is already a trivial 2-processor chain today (rfl::CamelCaseToSnakeCase + rfl::SnakeCaseToKebabCase), and acronym-aware word splitting / to_view case-transform helpers are high-bikeshed surface area with 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