On this page
Link, pull, and choose permissions๏
Prerequisite: dynamic mode and linking. A link creates the
relationship between two conduits. The borrower then requests a particular spell
from the conduit that owns it, using add_spell_to_contract(...).
The caller is the borrower๏
Keep these roles visible in your code:
The owner binds a spell and keeps its returned ID.
Both books conjure named conduits in the same dynamic world.
The conduits link.
The borrower names the owner and spell ID when it pulls the spell.
The borrower resolves through its own conduit.
An open link alone does not select the spells to share. The explicit pull is the boundary where the request names both its target and permissions.
Match access to the operation๏
The saved permission lessons compare create, read, and blocked sharing.
create allows construction through the contract; read is the more restricted
resolution path. Check whether the provider's instance exists before treating a
read request as permission to construct one. Follow the lesson's reported outcome
and refusal path rather than assuming every permission produces the same result.
Use SpellContract when the object you are constructing declares a dependency that will arrive over this relationship.
The workflow in code๏
These are the core steps from the saved example. Use its complete linked script for all class definitions and setup.
1def main() -> None:
2 owner_book = dynamic_spellbook()
3 spell_id = owner_book.bind(spell=SharedDirectory, existence="unique")
4
5 # SETTLEMENT - the first conjure on a fresh world carries the world
6 # decision: dynamic=True SETTLES the world dynamic, and it locks.
7 owner = owner_book.conjure(dynamic=True, name="owner")
8
9 # INHERITANCE - the borrower does not ask. It attaches to a world
10 # that is already dynamic; a plain conjure() inherits the mode.
11 borrower = dynamic_spellbook().conjure(name="borrower")
12
13 assert owner.link(borrower) is True
14 # Sharing is a PULL: the borrower asks, and the conduit it NAMES
15 # must OWN the spell being pulled.
16 borrower.add_spell_to_contract(spell_id=spell_id, conduit=owner,
17 permissions="create")
18 shared = borrower.meld(spell=SharedDirectory)
19 print("borrower melded the owner's spell:", shared.lookup())
20 print("settled once at first conjure; every later conduit inherited")
Runnable examples๏
Dynamic linking basics โ Intermediate 21
Permissions block sharing โ Intermediate 09
Permissions create vs read โ Intermediate 22
All intermediate examples ยท Level contents ยท Full contents