On this page

Spellspace scoped resolution๏ƒ

๐ŸŸก Intermediate ยท Lesson 04

Spellspaces are entered resolution rooms - one conduit can open many, and unique_per_spell_space pins one instance per room: stable inside a space, separate across spaces.

Before you run๏ƒ

Use the Intermediate guide for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules.

Run the saved script๏ƒ

python UX_and_AIX_experiences/02_intermediate/04_spellspace_scoped_resolution.py
py -3.14t UX_and_AIX_experiences/02_intermediate/04_spellspace_scoped_resolution.py

Download this collection ยท Source on GitHub

Public surface๏ƒ

md.Conduit.enter_spellspace, md.SpellSpace, md.Existence.unique_per_spell_space

Code๏ƒ

 1"""
 2TIER: intermediate (04)
 3GOAL: Spellspaces are entered resolution rooms - one conduit can open
 4      many, and unique_per_spell_space pins one instance per room:
 5      stable inside a space, separate across spaces.
 6SURFACE EXERCISED: md.Conduit.enter_spellspace, md.SpellSpace,
 7                   md.Existence.unique_per_spell_space
 8"""
 9import melder as md
10
11
12class RoomState:
13    pass
14
15
16def main() -> None:
17    book = md.Spellbook()
18    book.bind(spell=RoomState, existence=md.Existence.unique_per_spell_space)
19    conduit = book.conjure()
20
21    space_one = conduit.enter_spellspace()
22    space_two = conduit.enter_spellspace()
23    assert isinstance(space_one, md.SpellSpace)
24
25    one_a = space_one.meld(spell=RoomState)
26    one_b = space_one.meld(spell=RoomState)
27    two_a = space_two.meld(spell=RoomState)
28    print("stable within a space:", one_a is one_b)
29    print("separate across spaces:", one_a is not two_a)
30
31
32if __name__ == "__main__":
33    main()

Check the outcome๏ƒ

The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here.

More intermediate examples ยท Level guide

API contracts๏ƒ