On this page
Frames as worlds๏
๐ Advanced ยท Lesson 02
Aetheric frames are WORLDS - the categories arc, act three. Act 1 (beginner 25): spellframes categorize spells WITHIN a world. Act 2 (intermediate 26): conduits categorize worlds of resolution. Act 3: aetheric_frame= names an ENTIRE ISOLATED WORLD - its own registries, its own control plane, its own posture, its own singletons.
AND THE LINE THAT WALL DOES NOT CROSS, which is the real lesson:
A FRAME IS A WORLD FOR INSTANCES AND RESOLUTION. IT IS NOT A NAMESPACE FOR IDENTITY.
A spell_id is the SHA256 of the registered object's CODE - its methods and constructor, its class-level values, its bases - and of nothing from the bind call. READ THAT AGAIN AND NOTICE WHAT IS ABSENT: the frame, the spellframe, the binding_name. So two books on two different frames binding the same class mint THE SAME ID, whatever names they give it, and the second registration is refused process-wide. Moving to another frame is not a fix, and neither is another binding_name: one object is one spell.
The fix is to make the CLASSES different, not the worlds or the names: one subclass per world. A subclass is a new class, so a new spell_id, and every world can then keep it at the SAME address. Once you do, everything you expect from a world wall holds - unique is one instance PER FRAME, each world reuses its own singleton forever, and nothing leaks across.
THE OTHER WAY is a regime, not a binding: with process_wide_unique_spell_ids turned off before the first frame exists, a spell_id is unique per FRAME, and one class may live in several worlds. That is Aether configuration, and a lesson never installs it - lessons share one interpreter (advanced 07). The probe suite pins it in a reset world.
WHY IT IS BUILT THIS WAY: one spell_id names one spell, everywhere. An id that silently meant different things in different frames would make every checkpoint, every crystal and every research lane ambiguous the moment two frames existed.
Before you run๏
Use the Advanced 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/03_advanced/02_frames_as_worlds.py
py -3.14t UX_and_AIX_experiences/03_advanced/02_frames_as_worlds.py
Public surface๏
Spellbook(aetheric_frame=...), one class per world at one address, per-frame instance isolation
Code๏
1"""
2TIER: advanced (02)
3GOAL: Aetheric frames are WORLDS - the categories arc, act three.
4 Act 1 (beginner 25): spellframes categorize spells WITHIN a world.
5 Act 2 (intermediate 26): conduits categorize worlds of resolution.
6 Act 3: aetheric_frame= names an ENTIRE ISOLATED WORLD - its own
7 registries, its own control plane, its own posture, its own
8 singletons.
9
10 AND THE LINE THAT WALL DOES NOT CROSS, which is the real lesson:
11
12 A FRAME IS A WORLD FOR INSTANCES AND RESOLUTION.
13 IT IS NOT A NAMESPACE FOR IDENTITY.
14
15 A spell_id is the SHA256 of the registered object's CODE - its
16 methods and constructor, its class-level values, its bases - and
17 of nothing from the bind call. READ THAT AGAIN AND NOTICE WHAT IS
18 ABSENT: the frame, the spellframe, the binding_name. So two books
19 on two different frames binding the same class mint THE SAME ID,
20 whatever names they give it, and the second registration is
21 refused process-wide. Moving to another frame is not a fix, and
22 neither is another binding_name: one object is one spell.
23
24 The fix is to make the CLASSES different, not the worlds or the
25 names: one subclass per world. A subclass is a new class, so a new
26 spell_id, and every world can then keep it at the SAME address.
27 Once you do, everything you expect from a world wall holds -
28 `unique` is one instance PER FRAME, each world reuses its own
29 singleton forever, and nothing leaks across.
30
31 THE OTHER WAY is a regime, not a binding: with
32 `process_wide_unique_spell_ids` turned off before the first frame
33 exists, a spell_id is unique per FRAME, and one class may live in
34 several worlds. That is Aether configuration, and a lesson never
35 installs it - lessons share one interpreter (advanced 07). The
36 probe suite pins it in a reset world.
37
38 WHY IT IS BUILT THIS WAY: one spell_id names one spell, everywhere.
39 An id that silently meant different things in different frames
40 would make every checkpoint, every crystal and every research lane
41 ambiguous the moment two frames existed.
42SURFACE EXERCISED: Spellbook(aetheric_frame=...), one class per world at
43 one address, per-frame instance isolation
44VERIFY: rides the owner's 3.14t run; asserts are the contract.
45
46HISTORY: this lesson used to teach that two frames could bind the same
47class under the same name "with zero collision", and it carried a note
48warning that S2 of EPIC-2026-08-02-process-wide-spell-id-uniqueness would
49retire exactly that claim. S2 landed. The claim is retired, and the
50lesson now teaches the line instead of the half of it that survived.
51
520.2.8257: a spell_id became the SHA256 of the object's code, with nothing
53from the bind call in it, so a binding_name no longer makes one class two
54spells. The lesson used to bind TenantCache in both worlds under two
55binding_names; each world now binds its own subclass at one address.
56"""
57import melder as md
58
59
60class TenantCache:
61 pass
62
63
64class TenantACache(TenantCache):
65 """Tenant A's cache - a new class, so its own spell_id."""
66
67
68class TenantBCache(TenantCache):
69 """Tenant B's cache - a new class, so its own spell_id."""
70
71
72def main() -> None:
73 # Two books, two WORLDS. Naming the frame births it (lazy frames).
74 book_a = md.Spellbook(aetheric_frame="tenant-a")
75 book_b = md.Spellbook(aetheric_frame="tenant-b")
76
77 # ONE ADDRESS IN BOTH WORLDS, ONE CLASS PER WORLD. Binding TenantCache
78 # itself in both would be refused: its spell_id is its code, the same
79 # in every frame, and neither the frame nor a binding_name is in it.
80 book_a.bind(spell=TenantACache, existence="unique",
81 spellframe="tenant", binding_name="cache")
82 book_b.bind(spell=TenantBCache, existence="unique",
83 spellframe="tenant", binding_name="cache")
84
85 conduit_a = book_a.conjure(name="cache-a")
86 conduit_b = book_b.conjure(name="cache-b")
87
88 # The same address melds each world's own class.
89 cache_a = conduit_a.meld(spellframe="tenant", binding_name="cache")
90 cache_b = conduit_b.meld(spellframe="tenant", binding_name="cache")
91
92 # "unique" = one instance per FRAME. Two frames, two singletons.
93 assert type(cache_a) is TenantACache
94 assert type(cache_b) is TenantBCache
95 assert isinstance(cache_a, TenantCache) and isinstance(cache_b, TenantCache)
96 assert cache_a is not cache_b
97 print("one shape, two worlds, two singletons:", cache_a is not cache_b)
98
99 # Each world reuses ITS OWN singleton, forever.
100 assert conduit_a.meld(spellframe="tenant", binding_name="cache") is cache_a
101 assert conduit_b.meld(spellframe="tenant", binding_name="cache") is cache_b
102 print("per-frame reuse holds; nothing leaked across the wall")
103
104 # THE LINE, PROVEN. A third world binding tenant A's class - under a
105 # binding_name of its own - is refused, and the refusal names the
106 # spell_id: neither the frame nor the name was ever part of it.
107 book_c = md.Spellbook(aetheric_frame="tenant-c")
108 try:
109 book_c.bind(spell=TenantACache, existence="unique",
110 binding_name="another-name")
111 book_c.conjure(name="cache-c")
112 raise AssertionError("expected a process-wide spell_id refusal")
113 except RuntimeError as error:
114 assert "spell_id" in str(error) or "Spell ID" in str(error)
115 print()
116 print("a third frame binding the SAME class was refused:")
117 print(" frames isolate instances; they do not namespace identity")
118
119
120if __name__ == "__main__":
121 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.