Files
hakorune/docs/private/roadmap/phases/phase-20.17/PLAN.md

67 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Plan — Phase 20.17 (Full SelfHosting)
1) Lock boundaries and gates
- Freeze MIR(JSON v0) schema doc; add validator smoke
- Ensure GateC(Core) rc/output consistency across file/pipe
- Front EXE OK/NOOP/FAIL contract finalized (runner/loader/vm)
- Runner: nyvm(Core) 直行を既定wrapperはTTL互換。Selfhost経路は JSON→Interpreter で終端。
2) Stage pipeline (S0→S1→S2)
- S0 (Rust) builds S1 (Hakorune compiler AOT)
- S1 builds S2 from the same sources; compare artifacts (size/hash/canonical diff)
- Add timeboxed S3 for confidence (optional)
Status
- S2 canonical compare: driver側は既定ON化tools/stage/pipeline.sh。代表題材は緑
- CI への導入は最小1本から段階導入nestedif or phi 代表)
- Selfhost 最小系: emit→parse→execute の quick optin canary が PASSCore直行
3) Coverage to green契約準拠
- Builder: copy/unary/typeop/load/store/phi/compare/branch/jump/call/extern/boxcall(min) の契約準拠率を上げる
- Core VM mir_call: Array/Map/Extern/Method/ModuleFunction の最小セットFailFast タグ
- Reader: unaryunop/params/Constructor/Const/ModuleFunction のネスト表現を受理v0 互換)
4) Docs/TTLs
- Spec v1 docs, ABI minimal, stdlib nucleus
- Mark Rust boundary diagnostics as TTL; move into Core/fronts gradually
- Selfhost ガイドCore直行・子emit-only・first-line JSON 捕捉)の簡易 runbook を追加
---
## Optional/Bang sugarCallAttrs— 20.18 に移動(本フェーズでは設計のみ)
0) 前提・非目標20.18で実装、20.17はセルフホスティング優先)
- Published 名SSOTは増やさない`String.indexOf/1` のみ)。`?`/`!` は糖衣で CallAttrs.optionality に落とす。
- OptionalBox は本フェーズでは導入しない(代替として `{present:0|1, value:Any}` を使用する)。
1) Parser → MIR → JSON の配線20.18で実装)
- Parser: メソッド名末尾の `?`/`!` を検出し、AST.optional_mark=None|Question|Bang を付与(文字列名からは除去)。
- MIR: `CallAttrs.optionality = {Default, Optional, Bang}` を追加し、AST から転写。
- JSON v0: `mir_call.flags.optionality` を出力/読取(欠損は default
2) Verifier ガード20.18で実装)
- Optionality が default 以外で、対応メソッドでない場合は `E_OPTIONAL_UNSUPPORTED`FailFast
- 対応メソッドMVP: String.indexOf/lastIndexOf、Map.get、Array.get拡張は後続
3) Runtime最小スコープから20.18
- Rust interpreter: String.indexOf の Optionality を尊重
- Default: not found → -1互換
- Optional: not found → VoidBox
- Bang: not found → FailE_NOT_FOUND
- Map.get: Default=現行missing→Fail。Optional: `{present:0, value:Void}`。Bang: missing→Fail。
- GateC(Core) と nyvm 経路で同じ意味論を適用。
4) カナリアoptin20.18
- GateC/Core: `"abc".indexOf?("x") → Void``indexOf!("x") → E_NOT_FOUND``indexOf?("a") → 0`
- Map.get?missing → `{present:0}`、存在 → `{present:1, value:…}`表現は簡易Map
- Verifier: plugin メソッドへの `?`/`!``E_OPTIONAL_UNSUPPORTED`
5) Docs公開仕様と移行本フェーズは設計メモのみ
- Optional/Null セマンティクスMVPに Sugar→CallAttrs と JSON flags を追記(済)
- Testing Guide に Optional カナリアの観測方法VoidBox/簡易Mapを追記
- 20.18+ の OptionalBox 導入に向けた移行ノートを `TTLs` に記録
6) 拡張任意・後段20.19+
- Array.get の Optionality 反映empty時は Optional→Void
- Bang 版の代表を1本追加curated 昇格可)