Files
hakorune/docs/development/roadmap/phases/phase-12/README.md
Moe Charm 11506cee3b Phase 11-12: LLVM backend initial, semantics layer, plugin unification
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 23:44:34 +09:00

108 lines
3.6 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.

# Phase 12: Nyashコード共有エコシステム - Everything is Box の実現
## 🎯 重要な変更 (2025-09-01)
Phase 12の議論とビルトインBox廃止により、プラグインシステムが進化
**新しい3層プラグインシステムが確立されました**
```nyash
# Nyashスクリプトプラグインユーザー定義Box
box DataProcessor {
init {
me.file = new FileBox() # C ABIプラグイン使用
me.math = new MathBox() # C ABIプラグイン使用
me.cache = new MapBox() # これもC ABIプラグインビルトイン廃止
}
process(data) {
local result = me.math.sin(data)
me.file.write("log.txt", result.toString())
return result
}
}
# 使用例
local processor = new DataProcessor()
processor.process(3.14) # すべてプラグインで動作!
```
## 📝 なぜ誤解が生まれたのか
「プラグイン」という言葉から、特別な仕組みが必要だと考えてしまいましたが、Nyashの「Everything is Box」哲学により、ユーザー定義Boxこそが最高のプラグインシステムでした。
詳細な分析:[なぜ天才AIたちは間違えたのか](./WHY-AIS-FAILED.md)
## 🚀 Phase 12の真の価値コード共有エコシステム
### 本当に必要なもの
1. **export/import構文**
```nyash
# math_utils.ny
export box MathUtils {
factorial(n) { ... }
fibonacci(n) { ... }
}
# main.ny
import { MathUtils } from "math_utils.ny"
local utils = new MathUtils()
```
2. **パッケージマネージャー**
```bash
nyash install awesome-math-utils
nyash publish my-cool-box
```
3. **ドキュメント生成**
```nyash
# @doc 素晴らしい数学ユーティリティ
# @param n 計算したい数値
# @return 階乗の結果
export box MathUtils { ... }
```
## 📊 新しい3層プラグインシステム
```
NyashエコシステムビルトインBox廃止後
├── Nyashスクリプトプラグインユーザー定義Box← .nyashファイル
├── C ABIプラグイン既存のまま使用← シンプル・高速・安定
└── Nyash ABIプラグイン必要時のみ← 言語間相互運用・将来拡張
└── MIR命令は増やさないBoxCallにabi_hint追加のみ
```
### プラグイン選択の指針
- **C ABIで済むなら、C ABIを使う**(シンプルイズベスト)
- Nyash ABIは以下の場合のみ
- 他言語Python/Go等からの呼び出し
- 複雑な型の相互運用が必要
- 将来の拡張性を重視する場合
## 🛣️ 実装ロードマップ(修正版)
### Phase 12.1: export/import構文2週間
- [ ] exportキーワードのパーサー実装
- [ ] importステートメントの実装
- [ ] モジュール解決システム
- 📄 **[詳細仕様書](./export-import-spec.md)**
### Phase 12.2: パッケージ管理3週間
- [ ] nyash.tomlのdependencies対応
- [ ] 中央リポジトリ設計
- [ ] CLIツールinstall/publish
- 📄 **[パッケージマネージャー設計書](./package-manager-design.md)**
### Phase 12.3: 開発者体験向上(継続的)
- [ ] ドキュメント生成ツール
- [ ] VSCode拡張補完・定義ジャンプ
- [ ] サンプルパッケージ作成
---
### 🗄️ 議論の過程
AIたちがなぜ複雑な解決策を提案したのか、その議論の過程は `archive/` ディレクトリに保存されています。良い教訓として残しておきます。