[API Freeze] Remove legacy string enum comparisons #306

Closed
opened 2026-04-10 01:14:53 +00:00 by john · 0 comments
Owner

Context

The API consistency audit (docs/api-audit-2026-04.md, finding F13) identified that Key, InputState, and MouseButton enums support comparing to legacy string values for backward compatibility:

  • Key.ESCAPE == "Escape" → True
  • InputState.PRESSED == "start" → True
  • MouseButton.LEFT == "left" → True

This backward-compatibility layer adds complexity (custom __eq__ and __ne__ methods) and should be removed before 1.0.

Action Items

  • Remove custom __eq__/__ne__ from PyInputState that handles string comparison
  • Remove custom __eq__/__ne__ from PyKey that handles string comparison
  • Remove custom __eq__/__ne__ from PyMouseButton that handles string comparison
  • Remove the legacy_names mapping tables
  • Update any scripts/tests that use old string names
  • Document the change in migration guide

Files

  • src/PyInputState.cpp
  • src/PyKey.cpp
  • src/PyMouseButton.cpp
## Context The API consistency audit (docs/api-audit-2026-04.md, finding F13) identified that `Key`, `InputState`, and `MouseButton` enums support comparing to legacy string values for backward compatibility: - `Key.ESCAPE == "Escape"` → True - `InputState.PRESSED == "start"` → True - `MouseButton.LEFT == "left"` → True This backward-compatibility layer adds complexity (custom `__eq__` and `__ne__` methods) and should be removed before 1.0. ## Action Items - [ ] Remove custom `__eq__`/`__ne__` from `PyInputState` that handles string comparison - [ ] Remove custom `__eq__`/`__ne__` from `PyKey` that handles string comparison - [ ] Remove custom `__eq__`/`__ne__` from `PyMouseButton` that handles string comparison - [ ] Remove the `legacy_names` mapping tables - [ ] Update any scripts/tests that use old string names - [ ] Document the change in migration guide ## Files - `src/PyInputState.cpp` - `src/PyKey.cpp` - `src/PyMouseButton.cpp`
john closed this issue 2026-04-10 02:19:13 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#306
No description provided.