|
| 1 | +# RFC-0001 |
| 2 | + |
| 3 | +**Status:** Draft |
| 4 | +**Author:** |
| 5 | +**Target:** Internal Engine Architecture |
| 6 | +**Date:** March, 2026 |
| 7 | + |
| 8 | +## 1. Abstract |
| 9 | + |
| 10 | +## 2. Motivation |
| 11 | + |
| 12 | +## 3. Design Principles |
| 13 | + |
| 14 | +The following principles guide this design: |
| 15 | + |
| 16 | +### 3.1 Shape over semantics |
| 17 | + |
| 18 | +Concepts enforce type shape and API presence. |
| 19 | + |
| 20 | +### 3.2 Minimal Sufficiency |
| 21 | + |
| 22 | +Concepts should require only what is necessary for correctness and interoperability. |
| 23 | + |
| 24 | +### 3.3 Non-intrusiveness |
| 25 | + |
| 26 | +Concepts must not impose unnecessary contraints on layout, |
| 27 | +performance, or implementation strategy. |
| 28 | + |
| 29 | +## 4 Concepts |
| 30 | + |
| 31 | +### 4.1 MoveOnlyNoexcept |
| 32 | + |
| 33 | +#### 4.1.1 Definition |
| 34 | + |
| 35 | +A type satisfying MoveOnlyNoexcept: |
| 36 | + |
| 37 | +- Is moveable |
| 38 | +- Is not copyable |
| 39 | +- Has noexcept move construction and assignment |
| 40 | + |
| 41 | +#### 4.1.2 Rationale |
| 42 | + |
| 43 | +Registries and bundles represent ownership domains and must: |
| 44 | + |
| 45 | +- Avoid accidental copying |
| 46 | +- Be safely relocatable |
| 47 | + |
| 48 | +Noexcept move is required to preserve strong exception safety |
| 49 | +guarantees in higher-level systems. |
| 50 | + |
| 51 | +#### 4.1.3 Specification |
| 52 | + |
| 53 | +```cpp |
| 54 | +template <class T> |
| 55 | +concept MoveOnlyNoexcept = |
| 56 | + std::moveable<T> && |
| 57 | + !std::copy_constructible<T> && |
| 58 | + !std::copy_assignable_v<T> && |
| 59 | + std::is_nothrow_move_constructible_v<T> && |
| 60 | + std::is_nothrow_move_assignable_v<T>; |
| 61 | +``` |
| 62 | + |
| 63 | +### 4.2 RegistrySlot |
| 64 | + |
| 65 | +#### 4.2.1 Definition |
| 66 | + |
| 67 | +A type satisfying RegistrySlot: |
| 68 | + |
| 69 | +- Tracks whether the slot is live |
| 70 | +- Tracks the current generation of the slot |
| 71 | + |
| 72 | +#### 4.2.2 Rationale |
| 73 | + |
| 74 | +Slots represent storage locations for registry managed objects. |
| 75 | +They must: |
| 76 | + |
| 77 | +- Distinguish between live and free states |
| 78 | +- Participate in generation-based validation |
| 79 | + |
| 80 | +This enables: |
| 81 | + |
| 82 | +- Detection of stale handles |
| 83 | +- Safe reuse of slot indices |
| 84 | + |
| 85 | +#### 4.2.3 Specification |
| 86 | + |
| 87 | +```cpp |
| 88 | +template <class S> |
| 89 | +concept RegistrySlot = |
| 90 | + requires(S slot) { |
| 91 | + { slot.live } -> std::convertible_to<bool>; |
| 92 | + { slot.generation } -> std::convertible_to<uint32_t>; |
| 93 | + }; |
| 94 | +``` |
| 95 | +
|
| 96 | +Layer 1: common concepts |
| 97 | + • BundleLike |
| 98 | +
|
| 99 | +The following are explicitly out of scope for these concepts: |
| 100 | + • Enforcing transactional creation |
| 101 | + • Enforcing correct retirement semantics |
| 102 | + • Preventing logical misuse of handles |
| 103 | + • Guaranteeing destruction ordering |
| 104 | + • Enforcing trivial move or standard layout |
| 105 | +
|
| 106 | +Layer 2: registry CRTP base |
| 107 | +
|
| 108 | +Responsible for: |
| 109 | + • retire_queue_ |
| 110 | + • slots_ |
| 111 | + • free_ |
| 112 | + • alive() |
| 113 | + • allocate_handle_() |
| 114 | + • get_slot_if_live_() |
| 115 | + • retire_slot_() |
| 116 | + • clear() |
| 117 | +
|
| 118 | +Layer 3: concrete registry |
| 119 | +
|
| 120 | +FrameRegistry implements: |
| 121 | + • create() |
| 122 | + • make_retired_payload_() |
| 123 | + • retired payload destroy/cleanup trampolines |
| 124 | + • frame-specific accessors |
0 commit comments