Formalize exit PHI → variable_map reconnection with explicit LoopExitBinding
structure. Eliminates hardcoded variable names and prepares for Pattern 4+
multi-carrier support.
Key changes:
1. **New LoopExitBinding struct**:
- carrier_name: String (e.g., "sum", "count")
- join_exit_value: ValueId (JoinIR exit value)
- host_slot: ValueId (variable_map destination)
Makes it explicit: WHICH variable, FROM where, TO where.
2. **Updated JoinInlineBoundary**:
- Replaced implicit host_outputs: Vec<ValueId>
- With explicit exit_bindings: Vec<LoopExitBinding>
- Old APIs marked #[deprecated] for backward compatibility
3. **Pattern 3 now uses explicit bindings**:
Before: boundary.host_outputs = vec![sum_var_id] // implicit
After: boundary.exit_bindings = vec![LoopExitBinding {
carrier_name: "sum".to_string(),
join_exit_value: ValueId(18),
host_slot: sum_var_id,
}]
4. **merge_joinir_mir_blocks() updated**:
- Consumes exit_bindings instead of bare ValueIds
- Enhanced debug output shows carrier names
- Validates carrier name matches variable_map expectations
Benefits:
- Self-documenting code: bindings explain themselves
- Multi-carrier ready: Pattern 4+ just extend the vec![]
- Type-safe: No implicit semantics
- Debuggable: Explicit carrier name in logs
Test status:
- Build: ✅ SUCCESS (0 errors, 47 warnings)
- Pattern 3: ✅ PASS (no regressions)
- Backward compatibility: ✅ Maintained via #[deprecated]
Prepare for Phase 191: Pattern Router Table and Phase 192: JoinLoopTrace
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: ChatGPT <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Nyash Reference Documentation 📖
このディレクトリには、Nyashプログラミング言語の正式な技術仕様が含まれています。
📚 サブディレクトリ
language/
- 言語仕様(構文、型システム、Box仕様、デリゲーション)
- 正式な言語リファレンス
architecture/
- システムアーキテクチャ(MIR、VM、インタープリター)
- 実行バックエンド仕様
- 内部設計ドキュメント
api/
- ビルトインBoxのAPI仕様
- 標準ライブラリリファレンス
- 各Boxのメソッド詳細
plugin-system/
- プラグインシステム仕様
- BID-FFI(Box Interface Definition - Foreign Function Interface)
- プラグイン開発ガイド
📝 注意事項
このディレクトリのドキュメントは安定版です。開発中の仕様はdevelopment/を参照してください。