feat(phase-9.75g-0): Complete BID-FFI Day 5 - Plugin method calling system
## 🎉 Major Achievement - BID-FFI FileBox plugin fully functional with Nyash integration - Complete plugin-backed file I/O operations working - Successful write/read operations via FFI interface ## ✅ What Works - Plugin loading from nyash.toml configuration - FileBox plugin instantiation: `new FileBox(path)` - Method calls: `f.write("text")`, `f.read()` - Complete round-trip: Nyash → Plugin → File → Plugin → Nyash ## 🔧 Implementation Details - Added PluginFileBox method dispatch in execute_method_call() - Implemented execute_plugin_file_method() for read/write/exists/close - Fixed "Cannot call method on non-instance type" error - Plugin methods work via TLV encoding/FFI/decoding ## 🚨 Known Issue (Next Phase) Current implementation uses hardcoded method names (read/write/exists/close). This violates BID-FFI dynamic principles - methods should be discovered from plugin metadata, not hardcoded in Nyash interpreter. ## 📊 Test Results ``` local f f = new FileBox("test.txt") f.write("Hello from Nyash via plugin\!") print("READ=" + f.read()) # Output: READ=Hello from Nyash via plugin\! ``` 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -255,6 +255,11 @@ impl NyashInterpreter {
|
||||
return self.execute_file_method(file_box, method, arguments);
|
||||
}
|
||||
|
||||
// PluginFileBox method calls (BID-FFI system)
|
||||
if let Some(plugin_file_box) = obj_value.as_any().downcast_ref::<crate::bid::plugin_box::PluginFileBox>() {
|
||||
return self.execute_plugin_file_method(plugin_file_box, method, arguments);
|
||||
}
|
||||
|
||||
// ResultBox method calls
|
||||
if let Some(result_box) = obj_value.as_any().downcast_ref::<crate::box_trait::ResultBox>() {
|
||||
return self.execute_result_method(result_box, method, arguments);
|
||||
|
||||
Reference in New Issue
Block a user