feat: Major documentation reorganization and unified Box design updates
## Documentation & Organization - Moved copilot_issues.txt → 00_MASTER_ROADMAP.md (phases folder) - Created Phase 9.79b.1 & 9.79b.2 plans for unified Box implementation - Updated unified-box-design-deep-analysis.md with ChatGPT5 insights - Added P2P documentation and examples (ping-pong, self-ping) ## Code Updates - P2PBox: Reverted to original error state for demonstration - VM: Enhanced BoxCall dispatch for unified approach - Updated box factory, interpreter calls, and transport layer ## Cleanup & Privacy - Removed private/ and private_test/ from git tracking - Added private folders to .gitignore for security - Cleaned root directory: moved backups, removed temp files - Moved consultation files to docs/archive/consultations/ ## Other Improvements - Added object literal syntax improvement idea - Updated CLAUDE.md with master roadmap reference - Updated CURRENT_TASK.md with latest progress 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -539,10 +539,41 @@ impl VM {
|
||||
}
|
||||
|
||||
/// Call a method on a Box - simplified version of interpreter method dispatch
|
||||
pub(super) fn call_box_method(&self, box_value: Box<dyn NyashBox>, method: &str, _args: Vec<Box<dyn NyashBox>>) -> Result<Box<dyn NyashBox>, VMError> {
|
||||
pub(super) fn call_box_method(&self, box_value: Box<dyn NyashBox>, method: &str, mut _args: Vec<Box<dyn NyashBox>>) -> Result<Box<dyn NyashBox>, VMError> {
|
||||
// For now, implement basic methods for common box types
|
||||
// This is a simplified version - real implementation would need full method dispatch
|
||||
|
||||
// 🌟 Universal methods pre-dispatch (non-invasive)
|
||||
match method {
|
||||
"toString" => {
|
||||
if !_args.is_empty() {
|
||||
return Ok(Box::new(StringBox::new(format!("Error: toString() expects 0 arguments, got {}", _args.len()))));
|
||||
}
|
||||
return Ok(Box::new(StringBox::new(box_value.to_string_box().value)));
|
||||
}
|
||||
"type" => {
|
||||
if !_args.is_empty() {
|
||||
return Ok(Box::new(StringBox::new(format!("Error: type() expects 0 arguments, got {}", _args.len()))));
|
||||
}
|
||||
return Ok(Box::new(StringBox::new(box_value.type_name())));
|
||||
}
|
||||
"equals" => {
|
||||
if _args.len() != 1 {
|
||||
return Ok(Box::new(StringBox::new(format!("Error: equals() expects 1 argument, got {}", _args.len()))));
|
||||
}
|
||||
let rhs = _args.remove(0);
|
||||
let eq = box_value.equals(&*rhs);
|
||||
return Ok(Box::new(eq));
|
||||
}
|
||||
"clone" => {
|
||||
if !_args.is_empty() {
|
||||
return Ok(Box::new(StringBox::new(format!("Error: clone() expects 0 arguments, got {}", _args.len()))));
|
||||
}
|
||||
return Ok(box_value.clone_box());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// ResultBox (NyashResultBox - new)
|
||||
if let Some(result_box) = box_value.as_any().downcast_ref::<crate::boxes::result::NyashResultBox>() {
|
||||
match method {
|
||||
@ -562,11 +593,6 @@ impl VM {
|
||||
|
||||
// Legacy box_trait::ResultBox is no longer handled here (migration complete)
|
||||
|
||||
// Generic fallback: toString for any Box type
|
||||
if method == "toString" {
|
||||
return Ok(Box::new(StringBox::new(box_value.to_string_box().value)));
|
||||
}
|
||||
|
||||
// StringBox methods
|
||||
if let Some(string_box) = box_value.as_any().downcast_ref::<StringBox>() {
|
||||
match method {
|
||||
|
||||
Reference in New Issue
Block a user