Introduce Object storage abstraction (#735)

Add an opaque Object type for the key→value storage backing
Value::Object. It exposes a small set of methods (get, insert, remove,
iter, iter_sorted, cursor, serde) and keeps the backing store private,
so future representations -- inline small-map, hash-backed, lazy,
arena, FFI-callback -- can plug in without touching the call sites
that name this type.

Nothing in the engine uses Object yet. Value::Object still wraps
Rc<BTreeMap<Value, Value>>; the payload swap and call-site migration
come in the next PR. Object stands on its own unit tests in the
meantime.

docs/value/object.md walks through the design, the precedents it
follows (serde_json::Map, toml::Table, simdjson DOM), and the
concrete workloads the abstraction is meant to unlock.

A matching Set abstraction follows in a separate PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anand Krishnamoorthi
2026-06-04 12:31:15 -05:00
committed by GitHub
parent 5b7010ba16
commit 11940ddb04
8 changed files with 1123 additions and 4 deletions
+3 -3
View File
@@ -569,7 +569,7 @@ impl Analyzer {
}
Ok(false)
}
Array { .. } | Object { .. } => Ok(true),
Expr::Array { .. } | Expr::Object { .. } => Ok(true),
_ => Ok(false),
})?;
Ok(true)
@@ -666,7 +666,7 @@ impl Analyzer {
Ok(false)
}
// TODO: key vs value for object binding
Array { .. } | Object { .. } => Ok(true),
Expr::Array { .. } | Expr::Object { .. } => Ok(true),
_ => Ok(false),
})?;
Ok(vars)
@@ -853,7 +853,7 @@ impl Analyzer {
Ok(false)
}
// TODO: Object key/value
Array { .. } | Object { .. } => Ok(true),
Expr::Array { .. } | Expr::Object { .. } => Ok(true),
_ => {
non_vars.push(e.clone());
Ok(false)