Skip to main content

Module context

Module context 

Source
Expand description

Expression context — arena, symbol table, configuration. The Context is the user-facing entry point for symplex.

It owns an expression arena and an assumption cache, wrapped in a single RwLock for thread-safe access. Expressions (Ex) store a reference-counted handle to this inner state, so operators and queries work without any special scoping.

§Locking architecture

Arc<RwLock<ContextInner>>
  ├── arena: Arena                       (protected by outer RwLock)
  └── assumptions: Mutex<AssumptionCache> (interior lock for cache)
  • Display / structural checks: acquire outer read() — concurrent.
  • Expression construction: acquire outer write() — exclusive.
  • Assumption queries: acquire outer read() + inner assumptions.lock() — concurrent arena reads, serialized cache writes.

Lock ordering is inherent in the nesting: outer first, inner second. Deadlock is structurally impossible.

Structs§

Context
The user-facing entry point for symplex.