On this page
Scope Work and Resources๏
Reader Question๏
How should a web request, job, session, or nested operation receive an honest lifetime?
Short Answer๏
Choose the narrowest owner that matches the work. Frame-wide services use unique;
request/session state commonly uses unique_per_conduit; child work can share lineage
state; request-local ephemeral objects can live in an active SpellSpace; stateless work
can use many.
A Typical Request Shape๏
root = book.conjure()
request_scope = root.create_lesser_conduit()
try:
handler = request_scope.meld("RequestHandler")
handler.handle()
finally:
request_scope.cleanup()
The root retains broad services. The lesser conduit owns request-specific creations and inherits only the lifetimes designed to cross the lineage boundary.
Why This Design Is Strong๏
The object graph and lifetime graph agree. Reuse decisions are made by the owning store, and teardown can run deterministically when the scope ends rather than waiting for GC.
Tradeoffs๏
The application must end scopes deliberately and choose lifetime semantics during registration. This adds lifecycle design work and prevents accidental process-global state.
Where to Go Next๏
Isolate worlds for a wider boundary.
Evidence: