On this page
🟢 Beginner examples
41 saved lessons. Follow their order or choose a topic that answers your question.
Open the Beginner guide · All examples
- 🟢 Beginner · 01
Hello Melder
The sixty-second first contact - bind one class, conjure a conduit, meld an instance. The whole DGR in four lines.
RegistrationResolution - 🟢 Beginner · 02
Lifecycles unique vs many
The one decision every binding makes - where does instance reuse stop? unique = one shared instance; many = fresh construction per meld. This is Existence, the heart of the bind vocabulary.
RegistrationResolution - 🟢 Beginner · 03
Bind functions and instances
Spells are not only classes - functions and ready-made objects bind with the same verb. RUNTIME LAW (proven by the harness): callable and pre-built spells are always "unique" - the factory…
Registration - 🟢 Beginner · 04
Named bindings
Two implementations of one shape, told apart by binding_name - the beginner door into disambiguation (spellframes come later).
RegistrationResolution - 🟢 Beginner · 05
Lesser conduit scopes
Scopes without ceremony - a lesser conduit is a child resolution scope; unique_per_conduit gives each scope its own instance while plain unique stays shared across the family.
- 🟢 Beginner · 06
Error vocabulary
Failing well on day one - every exception melder raises at you is catchable from the root namespace. No internal paths, ever.
Resolution - 🟢 Beginner · 07
Strings as vocabulary
The vocabulary enums all accept their string names too - config files and CLI flags can drive registration without importing the enums. Both spellings resolve to the same lifecycles.
RegistrationResolutionLifetimes & cleanupConfiguration - 🟢 Beginner · 08
Disposal contract
Teardown is part of registration - disposal_method_names tells melder which methods to call on YOUR instances when their owner cleans up. No base class, no protocol: name the method, done.…
RegistrationResolutionLifetimes & cleanup - 🟢 Beginner · 09
Spellframe grouping
Spellframes are the grouping key above binding names - one frame key collects a family of related bindings, and (spellframe, binding_name) is the full lookup address.
RegistrationResolution - 🟢 Beginner · 10
Explicit cleanup
Teardown is a verb you own - conduit.cleanup() then book.cleanup(), in that order, and a cleaned book refuses further work loudly. (Disposal hooks you registered fire during this walk - see…
Lifetimes & cleanup - 🟢 Beginner · 11
Bind many at once
Registration is just Python - bind a whole list of classes with a plain loop. No special batch API needed, ever.
Registration - 🟢 Beginner · 12
Agent first read
An agent's first sixty seconds with melder: read the workflow map from help(), read the version, then open the hardcopy system docs the package carries about itself. No filesystem, no web -…
ResolutionAgent rooms & codegen - 🟢 Beginner · 13
Existence unique
unique, studied closely - ONE instance for the whole world: root conduit, child scopes, everywhere. The widest sharing mode.
- 🟢 Beginner · 14
Existence many
many, studied closely - construction EVERY meld, no caching anywhere. The mode for request-shaped, disposable things.
ResolutionLifetimes & cleanup - 🟢 Beginner · 15
Existence unique per conduit
unique_per_conduit - each conduit scope holds its OWN single instance; stable inside the scope, separate across scopes.
- 🟢 Beginner · 16
Typed melding
Type hints and melding are friends - annotate what you meld and your editor (and your agent) knows every attribute from there on. melder ships py.typed, so checkers see real types, not Any.
ResolutionAgent rooms & codegen - 🟢 Beginner · 17
Protocols as shapes
Protocols describe a SHAPE; bindings fill it - two implementations of one Protocol, chosen by binding name, called through the shared shape. Static duck typing meets dependency injection,…
RegistrationResolutionInspection - 🟢 Beginner · 18
Bootstrap pattern
The composition root - ONE function that binds the whole world and hands back the conduit. Configured things are BUILT there and bound as instances; everything else in the app just melds.…
RegistrationResolutionConfiguration - 🟢 Beginner · 19
Lifecycle map
The whole beginner lifecycle vocabulary on one page. Three modes answer one question - where does instance reuse stop? - and three is enough to build real things. (Three more exist for…
Lifetimes & cleanup - 🟢 Beginner · 20
Defaults just work
Your constructor defaults ARE the configuration - a class with default arguments melds without any extra setup. melder calls YOUR __init__; Python fills the defaults.
ResolutionConfiguration - 🟢 Beginner · 21
The basic rhythm
The rhythm of every melder program: bind everything FIRST, conjure ONCE, meld everywhere after. Three verbs, one order.
RegistrationResolution - 🟢 Beginner · 22
Same name different frames
binding_name is a SUB-key - the same name under two different frames is two different addresses. (frame, name) is always the full address; names never collide across frames.
RegistrationResearch & change - 🟢 Beginner · 23
Reading the errors
The three mistakes everyone makes in hour one, and what melder says back. Learn the error shapes once and debugging is easy.
ResolutionConnections - 🟢 Beginner · 24
Same class many names
One class, one spell - a spell_id is the SHA256 of the class's code, so the SAME class registers once, whatever binding name or lifecycle you give it (beginner 30). The working pattern for…
RegistrationLifetimes & cleanupConnectionsResearch & change - 🟢 Beginner · 25
Frames as dict classification
Spellframes are CATEGORIES. Organize one world's spells by the resolution ideas your app already has - "repositories", "notifiers" - and (category, name) becomes the full address. The…
RegistrationConnections - 🟢 Beginner · 26
Meld address forms
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;…
RegistrationResolution - 🟢 Beginner · 27
Pass the conduit around
App structure 101 - main() owns the conduit and PASSES it to the functions that need things. Don't re-conjure, don't stash globals: the conduit is the world handle, hand it around like one.
- 🟢 Beginner · 28
Real objects no wrappers
Melded objects are YOUR objects - no proxies, no wrappers, no magic subclasses. What comes back IS the instance: identity checks hold, isinstance holds, and it works everywhere a plain…
Resolution - 🟢 Beginner · 29
Many state isolation
"many" means ISOLATED - each melded instance owns its own state; mutating one never leaks into the next. The confusion this example prevents: expecting fresh objects to share anything.
Resolution - 🟢 Beginner · 30
Double bind outcome
Binding the SAME class twice is refused - a spell_id is the SHA256 of the class's code, and one object registers once, under any binding name or lifecycle. When one shape must serve two…
RegistrationLifetimes & cleanup - 🟢 Beginner · 31
Required vocabulary
existence is not optional - the bind vocabulary is explicit by design. Forgetting it fails LOUDLY at bind time, not quietly at meld time. The error type is printed for the record.
RegistrationResolution - 🟢 Beginner · 32
Factory functions
Two factory shapes, one law each - a FUNCTION spell is unique (one shared product); when you want a fresh object per meld, the factory must be a CLASS bound "many".
Resolution - 🟢 Beginner · 33
Prebuilt registry
A registry of ready-made same-typed objects. Spell names must be unique per book (probe-proven), so N instances of one class bind as ONE registry spell - the dict is the spell, lookup stays…
Registration - 🟢 Beginner · 34
Scope contrast one tree
unique vs unique_per_conduit in the SAME conduit tree - the side-by-side that makes scope reach click.
- 🟢 Beginner · 35
Disposal multiple methods
disposal_method_names takes a LIST - complex resources name every teardown verb they need, and the printed order documents how the runtime walks them.
RegistrationLifetimes & cleanup - 🟢 Beginner · 36
One book one conduit
One book conjures ONE conduit, ever (probe-proven: a second conjure raises RuntimeError). Multiple scopes come from lesser conduits; multiple roots come from multiple books.
- 🟢 Beginner · 37
Bind vocabulary cheatsheet
The whole bind vocabulary on one page - every kwarg a beginner will meet, printed as a cheatsheet next to a registration that uses ALL of them at once.
RegistrationLifetimes & cleanup - 🟢 Beginner · 38
Meld a frame as dict
Closing the dict-style loop - a small helper melds a whole frame family into a plain {name: instance} dict, because the (frame, name) address space maps 1:1 onto the dicts users already…
Resolution - 🟢 Beginner · 39
Agent inventory pattern
An agent classifying the library itself - walk md.__all__ and sort every name into callable vocabulary vs types vs errors vs metadata, producing the machine-readable inventory an agent…
RegistrationInspectionAgent rooms & codegen - 🟢 Beginner · 40
Beginner capstone
Build and use a small application across separate Python modules: ordinary objects, one bootstrap, a TYPE_CHECKING consumer, constructor injection, shared resources, fresh handlers, and…
RegistrationResolutionLifetimes & cleanup - 🟢 Beginner · 41
You own the memory now
YOU own the memory now - not the GC. A DI runtime HOLDS what it builds: your `unique` instance lives in the conduit's creations store, so dropping YOUR variable frees nothing - Python's…
ResolutionLifetimes & cleanup