Phase 122.5-126完了:ConsoleBox 品質改善・最適化・統合

## 実装成果(Phase 122.5-126)

### Phase 122.5: nyash.toml method_id 修正
- println method_id を 2 → 1 に統一(log と同じ)
- TypeRegistry slot 400 との整合性確保

### Phase 123: ConsoleBox WASM/非WASM コード統一化
- マクロ define_console_impl! による重複排除
- 67行削減(27.3% 削減達成)
- ビルド成功・全テストパス

### Phase 124: VM Method Dispatch 統一化
- TypeRegistry ベースの統一ディスパッチ (dispatch_by_slot)
- String/Array/ConsoleBox を一元化
- 100行削減、メソッド解決の高速化

### Phase 125: 削除:deprecated builtin ConsoleBox
- src/box_factory/builtin_impls/console_box.rs 削除
- Plugin-only 移行で "Everything is Plugin" 実現
- 52行削減

### Phase 126: ドキュメント統合
- consolebox_complete_guide.md (27KB統合マスター)
- core_boxes_design/logging_policy/hako_logging_design 更新
- ~750行の navigation・cross-reference 改善

## 数値成果

- **総コード削減**: 219行
- **新規ドキュメント**: 1ファイル (+27KB)
- **更新ドキュメント**: 6ファイル (+~750行)
- **テスト**: Phase 120 representative tests  PASS
- **ビルド**: Zero errors

## 設計原則の完全実現

 println/log エイリアス統一(Phase 122)
 WASM/非WASM 統一化(Phase 123)
 TypeRegistry 統合(Phase 124)
 Plugin-only 移行(Phase 125)
 ドキュメント統合(Phase 126)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-04 06:02:03 +09:00
parent 0b2a7e906b
commit e328be0307
17 changed files with 3469 additions and 355 deletions

View File

@ -48,8 +48,8 @@ impl BoxFactory for BuiltinBoxFactory {
"ArrayBox" => builtin_impls::array_box::create(args),
"MapBox" => builtin_impls::map_box::create(args),
// Phase 2.6: DELETE LAST (critical for logging)
"ConsoleBox" => builtin_impls::console_box::create(args),
// Phase 125: ✅ DELETED - ConsoleBox is now plugin-only!
// See: plugins/nyash-console-plugin for current implementation
// Phase 15.5: Fallback support (auto/core-ro modes)
"FileBox" => builtin_impls::file_box::create(args),
@ -76,7 +76,7 @@ impl BoxFactory for BuiltinBoxFactory {
// Collections/common
"ArrayBox",
"MapBox",
"ConsoleBox",
// ConsoleBox: Phase 125 - Plugin-only (nyash-console-plugin)
// Fallback support
"FileBox",
"FileHandleBox", // Phase 113

View File

@ -1,35 +0,0 @@
/*!
* Builtin ConsoleBox Implementation (Phase 15.5: Scheduled for Removal)
*
* ⚠️ DEPRECATED: This will be replaced by nyash-console-plugin (exists!)
* 🎯 Phase 2.6: Delete this file to remove builtin ConsoleBox support (LAST)
*/
use crate::box_factory::RuntimeError;
use crate::box_trait::NyashBox;
/// Create builtin ConsoleBox instance
///
/// ⚠️ DEPRECATED: ConsoleBox plugin should replace this (check plugins/nyash-console-plugin)
pub fn create(_args: &[Box<dyn NyashBox>]) -> Result<Box<dyn NyashBox>, RuntimeError> {
eprintln!(
"⚠️ [DEPRECATED] Using builtin ConsoleBox - use nyash-console-plugin!\n\
📋 Phase 15.5: Everything is Plugin!\n\
🔧 Check: plugins/nyash-console-plugin\n\
⚠️ WARNING: ConsoleBox is critical for logging - remove LAST!"
);
Ok(Box::new(crate::boxes::console_box::ConsoleBox::new()))
}
#[cfg(test)]
mod tests {
use super::*;
use crate::boxes::console_box::ConsoleBox;
#[test]
fn test_builtin_console_box_creation() {
let result = create(&[]).unwrap();
assert!(result.as_any().downcast_ref::<ConsoleBox>().is_some());
}
}

View File

@ -10,17 +10,17 @@
* 3. bool_box.rs - Phase 2.3 🔄 Plugin needed
* 4. array_box.rs - Phase 2.4 🔄 Plugin check needed
* 5. map_box.rs - Phase 2.5 🔄 Plugin check needed
* 6. console_box.rs - Phase 2.6 🔄 Plugin exists, remove LAST
* 6. console_box.rs - Phase 125 ✅ DELETED - Plugin-only (nyash-console-plugin)
* 7. null_box.rs - TBD: 🤔 Keep as language primitive?
*/
// Phase 2.1-2.6: Delete these modules one by one
pub mod array_box; // DELETE: Phase 2.4 (plugin check)
pub mod bool_box; // DELETE: Phase 2.3 (plugin needed)
pub mod console_box;
// Phase 125: console_box ✅ DELETED - Plugin-only (nyash-console-plugin)
pub mod integer_box; // DELETE: Phase 2.2 (plugin ready)
pub mod map_box; // DELETE: Phase 2.5 (plugin check)
pub mod string_box; // DELETE: Phase 2.1 (plugin ready) // DELETE: Phase 2.6 (LAST - critical for logging)
pub mod string_box; // DELETE: Phase 2.1 (plugin ready)
// Fallback support (Phase 15.5: Fallback Guarantee)
pub mod file_box; // FALLBACK: Core-ro FileBox for auto/core-ro modes