Files
hakorune/docs/archive/cleanup/legacy-byname-removal.md
nyash-codex 2dfe363365 refactor(joinir): Phase 242-EX-A - Delete legacy Pattern3 lowerer
Remove hardcoded Pattern3 PoC implementation (loop_with_if_phi_minimal.rs)
and enhance if-sum mode to handle complex conditions like `i % 2 == 1`.

Key changes:
- condition_pattern.rs: Accept BinaryOp in comparison operands (+58 lines)
- loop_with_if_phi_if_sum.rs: Dynamic complex condition lowering (+147 lines)
- pattern3_with_if_phi.rs: Remove lower_pattern3_legacy() (-130 lines)
- loop_with_if_phi_minimal.rs: Delete entire file (-437 lines)
- loop_patterns/with_if_phi.rs: Update stub (-45 lines)
- mod.rs: Remove module reference (-4 lines)

Net reduction: -664 lines of hardcoded PoC code

Test results: 909/909 PASS (legacy mode completely removed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 01:27:08 +09:00

2.2 KiB
Raw Blame History

Status: Historical

Legacy ByName Call Removal Plan

Context

  • Unified call system is default. VM routes by Callee kind (Global/Method/Extern/…)
  • Legacy byname resolution (callee=None → string name lookup) is gated by env and OFF by default.
  • Goal: remove legacy code path once parity is proven at integration/full levels.

Guards / Current Behavior

  • 旧 byname 経路は削除済み。NYASH_VM_ALLOW_LEGACY は廃止。
  • 既定: callee=None 生成時は FailFastBuilder で Callee を必ず付与)。

Scope of Work

  1. Identify callers that could still rely on legacy resolution

    • Builder emissions that may omit callee (should be none after Phase 1 refactor)
    • Any VM entry points or helpers constructing byname calls dynamically
    • Older tests or tools expecting byname lookups
  2. Ensure unified path covers them

    • For Global user functions: attach Callee::Global("Module.func")
    • For dynamic/indirect calls: mark Callee::Value and keep VM restrictions explicit
    • For externlike names: delegate via handlers/calls/externs.rs (SSOT)
    • Normalize arity (foo/1foo) via utils::normalize_arity_suffix
  3. Strengthen tests

    • Smokes/quick: unified pathbyname 不可)を既に強制
    • Integration/full: ユーザー関数呼び出し/extern 名正規化のカナリアを追加
    • 旧ENV依存がないことを確認NYASH_VM_ALLOW_LEGACY は削除済)
  4. Remove legacy code path

    • Delete src/backend/mir_interpreter/handlers/calls/legacy.rs and its resolver module
    • Drop env guard checks referring to legacy path (keep error message clarity)
    • Update READMEs to remove temporary notes

Readiness Criteria (before removal)

  • quick/integration/full all green with legacy OFF
  • No callee=None emission in builder (verified by grepping MIR JSON / code review)
  • Extern SSOT accepts aritysuffixed names; Global externlike names delegate properly

Rollback Plan

  • Keep a small revertable commit boundary for legacy deletion
  • If issues appear, reintroduce legacy.rs with the same path under a devguard until fixed

CrossReferences

  • handlers/calls/README.md (SSOT and boundaries)
  • docs/ENV_VARS.md (env guards and policies)