nustack

Context

A Context is the union of Fabrics a program runs against. It is the full addressable space; each Fabric is an element of it.

Role

  • a program names Refs symbolically and composes them with Interactions;
  • it runs against a Context;
  • the Context routes each Ref to the Fabric that owns its address space;
  • the Fabric resolves the address and carries out the Interaction.

Same program, different Context = different bag of Fabrics = different world. Test, staging, and prod all run the same description by swapping the binding.

What Context is not

  • not global state. Every binding is on a Context value. Two evaluations with two Contexts do not see each other.
  • not a name-to-value dict. It routes Refs to Fabrics; the values live in the Fabrics.
  • not the program. The program is the Interaction tree. The Context is the world the tree runs against.

Immutability

A Context is immutable. Extending it (adding a Fabric, narrowing a binding) produces a new Context; the parent is unchanged. This is what lets a Span narrow Context for its body without leaking the narrowed bindings to siblings.

Resolution

How a Ref finds its Fabric inside a Context is not a flat name lookup. It is a structured protocol - see 02-protocol.md.

On this page