On this page
Meld address forms๏
๐ข Beginner ยท Lesson 26
THE ADDRESS LAW (run-proven + doc-canon): every spell lives at one (frame_key, binding_key) address - frame_key is your spellframe, or the spell's normalized name if you gave none; binding_key is your binding_name, or the default slot. The meld forms are just three ways to CONSTRUCT that key - so a frameless, nameless bind answers to the spell object and to spell_name; a framed+named bind answers only at (frame, name).
Before you run๏
Use the Beginner 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/01_beginner/26_meld_address_forms.py
py -3.14t UX_and_AIX_experiences/01_beginner/26_meld_address_forms.py
Public surface๏
meld(Class), meld("SpellName"), meld(spell_id=...), meld(spellframe=..., binding_name=...)
Code๏
1"""
2TIER: beginner (26)
3GOAL: THE ADDRESS LAW (run-proven + doc-canon): every spell lives at
4 one (frame_key, binding_key) address - frame_key is your spellframe,
5 or the spell's normalized name if you gave none; binding_key is
6 your binding_name, or the default slot. The meld forms are just
7 three ways to CONSTRUCT that key - so a frameless, nameless bind
8 answers to the spell object and to spell_name; a framed+named
9 bind answers only at (frame, name).
10SURFACE EXERCISED: meld(Class), meld("SpellName"), meld(spell_id=...),
11 meld(spellframe=..., binding_name=...)
12"""
13import melder as md
14
15
16class BillingService:
17 def total(self) -> int:
18 return 42
19
20
21class LedgerService:
22 pass
23
24
25def main() -> None:
26 book = md.Spellbook()
27 # default address: ("billingservice", default slot)
28 spell_id = book.bind(spell=BillingService, existence="unique")
29 # explicit address: ("finance", "ledger")
30 book.bind(spell=LedgerService, existence="unique",
31 spellframe="finance", binding_name="ledger")
32 conduit = book.conjure()
33
34 by_object = conduit.meld(spell=BillingService)
35 by_name = conduit.meld(spell="BillingService")
36 # Explicit machine form: SHA identity never shares the human string slot.
37 by_id = conduit.meld(spell_id=spell_id)
38 assert by_object is by_name is by_id
39 print("default-address spell answers all three:", by_object.total())
40
41 ledger = conduit.meld(spellframe="finance", binding_name="ledger")
42 assert isinstance(ledger, LedgerService)
43 print("framed spell answers at (frame, name)")
44
45 try:
46 conduit.meld(spell="LedgerService")
47 except KeyError as err:
48 print("name-derived key misses a framed bind:", err)
49
50 try:
51 conduit.meld(binding_name="ledger")
52 except ValueError as err:
53 print("binding_name alone refused:", err)
54
55
56if __name__ == "__main__":
57 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.