feat(9.75f-1): Implement plugin loader and interpreter integration

- Add plugin_loader.rs with FileBoxProxy implementation
- Integrate dynamic FileBox into interpreter (execute_new, method calls)
- Add feature flag 'dynamic-file' support throughout
- Create test program test_dynamic_filebox.nyash
- Plugin builds in 2.86s (vs main build 2+ minutes\!)

Build time improvement confirmed:
- Plugin-only build: 2.86s 
- Main build: 2+ minutes (timeout)

Next: Complete testing once main build finishes
This commit is contained in:
Moe Charm
2025-08-17 04:23:09 +09:00
parent 226618de05
commit bd20c91b67
6 changed files with 460 additions and 3 deletions

View File

@ -96,9 +96,20 @@ impl NyashInterpreter {
}
let path_value = self.execute_expression(&arguments[0])?;
if let Some(path_str) = path_value.as_any().downcast_ref::<StringBox>() {
let file_box = Box::new(FileBox::new(&path_str.value)) as Box<dyn NyashBox>;
// 🌍 革命的実装Environment tracking廃止
return Ok(file_box);
#[cfg(feature = "dynamic-file")]
{
// 動的ライブラリ経由でFileBoxを作成
use crate::interpreter::plugin_loader::PluginLoader;
let file_box = PluginLoader::create_file_box(&path_str.value)?;
return Ok(file_box);
}
#[cfg(not(feature = "dynamic-file"))]
{
// 静的リンク版
let file_box = Box::new(FileBox::new(&path_str.value)) as Box<dyn NyashBox>;
return Ok(file_box);
}
} else {
return Err(RuntimeError::TypeError {
message: "FileBox constructor requires string path argument".to_string(),