docs: Phase 142 P2 Step 3-B design decisions fixed

- Pattern5 handles return (not Pattern4) - prevents bloat as parse_*/continue family expands
- ExitMeta expansion NOT needed initially - return ends function, no carrier reconnect needed
- Return payload self-contained within Pattern5 (temporary/direct return, no phi merge)
- ContinueReturn asset reuse: extract consistency checks only (not exit_line machinery)
- Implementation checklist prepared for next session

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-16 14:18:42 +09:00
parent 2674e074b6
commit 26077186aa

View File

@ -455,11 +455,62 @@ The following patterns are rejected with explicit error messages:
**Status**: 🔄 DEFERRED for separate session - Large-scale implementation requires careful design **Status**: 🔄 DEFERRED for separate session - Large-scale implementation requires careful design
**Why separate**: JoinIR generation involves responsibility boundary decisions (Pattern4 direct vs delegation to Pattern5) and ExitMeta/payload handling. Separating ensures cleaner cause analysis. **Why separate**: JoinIR generation involves responsibility boundary decisions and ExitMeta/payload handling. Separating ensures cleaner cause analysis.
**Design questions to resolve first**: ### 🔑 Design Decisions (FIXED for Phase 142 P2 Step 3-B)
1. Should return be handled directly in Pattern4 lowerer, or delegated to Pattern5?
2. How to transport return payload through exit/boundary/ExitMeta (can we reuse ContinueReturn assets)? #### 1. Return Responsibility Boundary: Pattern5
**Decision**: Return handling → Pattern5 (not Pattern4)
**Rationale**:
- Pattern4 responsibility: "continue + update rules" only
- Pattern5 responsibility: "continue + early return" integration
- Prevents Pattern4 from bloating as parse_string/array/object family expands
- Aligns with canonicalizer SSOT ("structure is notes, chosen is final lowerer")
**Architecture**:
```
Pattern4Continue (recognizer)
Pattern4Lowerer (continue only)
↓ (has_return? → delegate)
Pattern5Lowerer (continue + early return)
```
#### 2. Return Payload Transport: Closed within Pattern5
**Decision**: ExitMeta expansion NOT needed (initially)
**Rationale**:
- **Judgment criteria**: "Does return need the same exit_line reconnection as break?"
- **Answer for parse_***: No - "return ends the function" (not carrier reconnect)
- **Therefore**: Close return payloads within Pattern5 lowerer (no cross-boundary phi)
**Payload Handling**:
1. Return value lives in a temporary (or direct function return)
2. No phi merge with continue-side carrier updates
3. Return path is self-contained within Pattern5
**ContinueReturn Asset Reuse**:
- ✅ Extract: Value consistency checks + transport logic
- ❌ Don't reuse: exit_line reconnection machinery (not needed)
- Reuse only the "payload consistency validation" parts
### 📋 Implementation Checklist for Step 3-B (Next Session)
**Preparation**:
- [ ] Design Pattern5 entry point (new or enhance existing Pattern5)
- [ ] Map return payload handling (temporary, no phi merge)
- [ ] Document ExitMeta usage (confirm unchanged)
- [ ] Identify ContinueReturn reusable parts (consistency checks)
**Implementation**:
- [ ] Create `pattern5_continue_return_minimal.rs` lowerer
- [ ] Add return path handling (closed within Pattern5)
- [ ] Use existing carrier reconnection from Pattern4 (for continue side)
- [ ] Test on parse_string minimal fixture
- [ ] Verify no ExitMeta changes needed
### SSOT References ### SSOT References