Files
hakorune/src/box_factory/builtin_impls/bool_box.rs
Selfhosting Dev 56f128eecd 🎉 feat: Phase 15.5革命完了!StringBox/IntegerBoxプラグイン優先度問題根治
何十日間の激闘ついに完全解決!"Everything is Plugin"哲学実装達成🚀

🏆 核心成果:
- FactoryPolicy システム完全実装 (StrictPluginFirst/CompatPluginFirst/BuiltinFirst)
- プラグイン優先をデフォルト化: plugins > user > builtin
- builtin_impls/ 分離実装でPhase 2削除準備完了
- unified_registry.rs でwith_env_policy()によるポリシー制御
- 環境変数制御: NYASH_BOX_FACTORY_POLICY=strict_plugin_first

🔧 技術実装:
- src/box_factory/mod.rs: FactoryPolicy enum + rebuild_cache() + policy-based ordering
- src/box_factory/builtin.rs: builtin_impls/への振り分け実装
- src/box_factory/builtin_impls/: 7ファイル分離 (削除順序コメント付き)
- src/runtime/unified_registry.rs: with_env_policy() でStrictPluginFirst デフォルト

 動作確認完了:
- StringBox プラグイン優先で作成成功
- Factory Policy: StrictPluginFirst メッセージ確認
- プラグイン初期化確認 (Net plugin, FileBox plugin)

📋 Phase 2準備完了: builtin_impls/ 段階削除戦略
1. string_box.rs, integer_box.rs (プラグイン準備済み)
2. bool_box.rs (プラグイン要作成)
3. array_box.rs, map_box.rs (プラグイン確認要)
4. console_box.rs (最後 - ログ用に重要)

🎯 ChatGPT戦略 + ユーザー分離アイデアの完璧な統合実装成果!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 11:43:11 +09:00

38 lines
1.1 KiB
Rust

/*!
* Builtin BoolBox Implementation (Phase 15.5: Scheduled for Removal)
*
* ⚠️ DEPRECATED: This will be replaced by nyash-bool-plugin (to be created)
* 🎯 Phase 2.3: Delete this file to remove builtin BoolBox support
*/
use crate::box_trait::{NyashBox, BoolBox};
use crate::box_factory::RuntimeError;
/// Create builtin BoolBox instance
///
/// ⚠️ DEPRECATED: BoolBox plugin needs to be created
pub fn create(args: &[Box<dyn NyashBox>]) -> Result<Box<dyn NyashBox>, RuntimeError> {
eprintln!(
"⚠️ [DEPRECATED] Using builtin BoolBox - BoolBox plugin needed!\n\
📋 Phase 15.5: Everything is Plugin!\n\
🔧 TODO: Create nyash-bool-plugin"
);
if let Some(arg0) = args.get(0) {
if let Some(bb) = arg0.as_any().downcast_ref::<BoolBox>() {
return Ok(Box::new(BoolBox::new(bb.value)));
}
}
Ok(Box::new(BoolBox::new(false)))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_builtin_bool_box_creation() {
let result = create(&[]).unwrap();
assert!(result.as_any().downcast_ref::<BoolBox>().is_some());
}
}