feat: support opt-in shared reference assignment for host objects

This commit is contained in:
2026-10-20 20:55:25 +08:00
parent df1b77fc1a
commit 7c842789c0
7 changed files with 169 additions and 7 deletions
+8
View File
@@ -96,6 +96,14 @@ pub trait ObjectPayload: Any + fmt::Debug + Send + Sync {
fn call(&self, _arguments: &[Value]) -> Result<Value, VmError> {
Err(VmError::UnsupportedOperation("call"))
}
/// Opt-in shared-reference assignment. Returning true preserves the existing
/// object identity after replacing its host-owned target. Ordinary payloads
/// return false and retain normal value assignment. Implementations must
/// validate before mutation and must not add untraced managed-object edges.
fn assign_from(&self, _source: &dyn ObjectPayload) -> Result<bool, VmError> {
Ok(false)
}
}
#[derive(Debug, Default)]