feat(plugin): Fix plugin BoxRef return and Box argument support
- Fixed deadlock in FileBox plugin copyFrom implementation (single lock) - Added TLV Handle (tag=8) parsing in calls.rs for returned BoxRefs - Improved plugin loader with config path consistency and detailed logging - Fixed loader routing for proper Handle type_id/fini_method_id resolution - Added detailed logging for TLV encoding/decoding in plugin_loader_v2 Test docs/examples/plugin_boxref_return.nyash now works correctly: - cloneSelf() returns FileBox Handle properly - copyFrom(Box) accepts plugin Box arguments - Both FileBox instances close and fini correctly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -0,0 +1,119 @@
|
||||
# 📦 Nyash実用的配布戦略:現実的なアプローチ
|
||||
|
||||
## 🎯 **配布形態の比較**
|
||||
|
||||
| 方式 | ファイルサイズ | 配布の手間 | 適用範囲 | 実用性 |
|
||||
|------|--------------|-----------|---------|--------|
|
||||
| **個別バイナリ** | 各1-2MB | OS別に配布 | 全アプリ | ⭐⭐⭐⭐⭐ |
|
||||
| **APE** | 3-6MB | 1ファイル | 小規模CLI | ⭐⭐⭐ |
|
||||
| **WASM+ランタイム** | 0.5MB+10MB | ランタイム必要 | 全アプリ | ⭐⭐⭐⭐ |
|
||||
|
||||
## 📊 **現実的な使い分け**
|
||||
|
||||
### **1. メインストリーム配布(推奨)**
|
||||
```bash
|
||||
# OS別の最適化されたバイナリ
|
||||
nyash-linux-x64 (1.5MB) - musl静的リンク
|
||||
nyash-windows.exe (916KB) - mingw最適化
|
||||
nyash-macos (1.8MB) - 署名付き
|
||||
```
|
||||
|
||||
**利点**:
|
||||
- ✅ 各OSで最高性能
|
||||
- ✅ 最小サイズ
|
||||
- ✅ OS固有機能フル活用
|
||||
- ✅ 大規模アプリも対応
|
||||
|
||||
### **2. 開発者向け配布**
|
||||
```bash
|
||||
# LLVM IRの中立性を活用
|
||||
nyashc --emit-bitcode program.nyash
|
||||
# → program.bc (プラットフォーム中立)
|
||||
|
||||
# 各自のマシンで最適化コンパイル
|
||||
nyashc --from-bitcode program.bc --target native
|
||||
```
|
||||
|
||||
### **3. 特殊用途でのAPE**
|
||||
```bash
|
||||
# 小さなツール限定
|
||||
nyash-fmt.com # コードフォーマッター (2MB)
|
||||
nyash-lint.com # リンター (3MB)
|
||||
nyash-repl.com # REPL (4MB)
|
||||
```
|
||||
|
||||
**APEが向いている場合**:
|
||||
- 単体で動くCLIツール
|
||||
- 依存ライブラリが少ない
|
||||
- 配布の簡単さが最優先
|
||||
|
||||
**APEが向いていない場合**:
|
||||
- GUIアプリケーション
|
||||
- 大量のライブラリ依存
|
||||
- プラグインシステム
|
||||
- ゲームなど大規模アプリ
|
||||
|
||||
## 🚀 **段階的実装計画(修正版)**
|
||||
|
||||
### **Phase 1: 基本マルチターゲット**(1ヶ月)
|
||||
```bash
|
||||
nyashc build --target linux
|
||||
nyashc build --target windows
|
||||
# 個別にビルド、確実に動作
|
||||
```
|
||||
|
||||
### **Phase 2: 同時生成最適化**(3ヶ月)
|
||||
```bash
|
||||
nyashc build --all-targets
|
||||
# Bitcodeキャッシュで高速化
|
||||
# 並列ビルドで時間短縮
|
||||
```
|
||||
|
||||
### **Phase 3: 配布自動化**(6ヶ月)
|
||||
```bash
|
||||
nyashc release
|
||||
# 出力:
|
||||
# - dist/nyash-v1.0-linux-x64.tar.gz
|
||||
# - dist/nyash-v1.0-windows-x64.zip
|
||||
# - dist/nyash-v1.0-macos.dmg
|
||||
# - dist/nyash-tools.com (APE版ツール集)
|
||||
```
|
||||
|
||||
## 💡 **賢い配布戦略**
|
||||
|
||||
### **メインアプリ**: 個別最適化バイナリ
|
||||
```yaml
|
||||
nyash本体:
|
||||
Linux: 1.5MB (musl静的)
|
||||
Windows: 916KB (mingw)
|
||||
macOS: 1.8MB (universal)
|
||||
```
|
||||
|
||||
### **開発ツール**: APEで統一
|
||||
```yaml
|
||||
開発者ツール(APE):
|
||||
nyash-fmt.com: 2MB
|
||||
nyash-test.com: 3MB
|
||||
nyash-bench.com: 2.5MB
|
||||
```
|
||||
|
||||
### **プラグイン**: 動的ライブラリ
|
||||
```yaml
|
||||
プラグイン(各OS別):
|
||||
filebox.so: 200KB (Linux)
|
||||
filebox.dll: 180KB (Windows)
|
||||
filebox.dylib: 220KB (macOS)
|
||||
```
|
||||
|
||||
## 🎉 **結論**
|
||||
|
||||
**「適材適所」が最強の戦略!**
|
||||
|
||||
- **大規模アプリ**: 個別最適化バイナリ
|
||||
- **小規模ツール**: APEで配布簡略化
|
||||
- **開発者向け**: Bitcodeで柔軟性確保
|
||||
|
||||
APEは「魔法」だけど、現実的には**限定的な用途**で輝く技術。
|
||||
Nyashのメイン配布は**堅実な個別バイナリ**で行きましょう!
|
||||
|
||||
**Everything is Box、でも配布は現実的に!**📦✨
|
||||
Reference in New Issue
Block a user