🚀 Phase 10.11: Everything is Plugin革命完了!

主な変更:
- ConsoleBox/MathBoxプラグイン実装・登録完了
- nyash_box.toml 2ファイルシステム設計(中央レジストリ+個別仕様書)
- 全プラグインにnyash_box.tomlテンプレート追加
- プラグイン優先機能(NYASH_USE_PLUGIN_BUILTINS=1)文書化
- ビルトインBox削除準備(ChatGPT5実装中)
- ネイティブビルドデモ追加(Linux/Windows動作確認済み)

Everything is Box → Everything is Plugin への歴史的転換!
開発20日目にしてビルトインBox全削除という革命的決定。

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-30 01:33:52 +09:00
parent 15e0a1ab34
commit 1b98f85df9
34 changed files with 1410 additions and 62 deletions

View File

@ -397,3 +397,16 @@ bash tools/build_aot.sh examples/aot_min_string_len.nyash -o app
- 状態確認: `git status` / `git log --oneline -3` / `cargo check`
- スモーク: `bash tools/smoke_phase_10_10.sh`
- 次の一手: core_hostcall → core_ops の順に分割、毎回ビルド/スモークで確認
---
### 新規フェーズ(提案): Phase 10.11 Builtins → Plugins 移行
- 目的: 内蔵Box経路を段階的に廃止し、プラグイン/ユーザーBoxに一本化する不具合の温床を解消
- 現在の足場(済):
- ConsoleBox コンストラクタをレジストリ委譲(プラグイン優先)に変更
- `NYASH_DISABLE_BUILTINS=1` でビルトインFactory登録を抑止可能
- 設計ドキュメント: docs/development/roadmap/phases/phase-10.11-builtins-to-plugins.md
- 次ステップ:
- 非基本コンストラクタの委譲徹底Math/Random/Sound/Debugなど
- 主要ビルトインの plugin 化nyash_box.toml 整備)
- CIに `NYASH_USE_PLUGIN_BUILTINS=1` / `NYASH_PLUGIN_OVERRIDE_TYPES` のスモークを追加

View File

@ -0,0 +1,54 @@
# Phase 10.11: Builtins → Plugins Migration
## Goals
- Remove builtin Box implementations from execution paths (Interpreter/VM/JIT) to avoid divergence and double sources of truth.
- Provide all functionality via plugins (BID-FFI v1) and/or user-defined boxes.
- Keep backward compatibility guarded behind env flags until migration completes.
## Rationale
- Conflicts like ConsoleBox builtin vs plugin cause unexpected behavior.
- Native build (AOT/EXE) path benefits from uniform plugin boundary.
- One registry, one implementation per Box: simpler, safer.
## Plan (Incremental)
1) Disable Switch (Now)
- Add `NYASH_DISABLE_BUILTINS=1` to skip registering builtin box factory.
- Keep off by default; use in CI lanes and targeted tests.
2) Constructor Delegation (Now → Next)
- Ensure all constructors go through the unified registry, not direct builtin instantiation.
- Done: ConsoleBox; Next: remaining non-basic constructors.
3) Override Policy (Ongoing)
- Use `NYASH_USE_PLUGIN_BUILTINS=1` + `NYASH_PLUGIN_OVERRIDE_TYPES` to prefer plugins for selected types.
- Grow the allowlist as plugins become available.
4) Plugin Coverage (Milestones)
- ConsoleBox (stdout) — done
- Array/Map/String/Integer — in place
- File/Net/Python — in place
- Math/Time/etc. — add `nyash_box.toml` and minimal plugins
5) Remove Builtins (Final)
- Remove builtin factory or move into separate optional crate for legacy runs.
- Update docs, examples, and CI to plugin-only.
## Acceptance Criteria
- `NYASH_DISABLE_BUILTINS=1` + plugin set → examples run green (VM path).
- No direct builtins in interpreter constructors (registry only).
- JIT/AOT compile from MIR uses only plugin invoke shims for Box methods.
## How to Test
```bash
# Strict plugin preference + disable builtins
export NYASH_USE_PLUGIN_BUILTINS=1
export NYASH_PLUGIN_OVERRIDE_TYPES="ArrayBox,MapBox,ConsoleBox,StringBox,IntegerBox"
export NYASH_DISABLE_BUILTINS=1
cargo build --release --features cranelift-jit
./target/release/nyash --backend vm examples/console_demo.nyash
```
## Notes
- Temporary breakages expected when some builtin-only boxes remain. Use the override allowlist tactically.
- Keep `[libraries]` and `[plugins]` configured to ensure provider discovery.