Patterns¶
Patterns show how Dracon's primitives compose into real-world solutions. They assume you're comfortable with the basics from the tutorials.
Start Here¶
- Runtime Contracts - Keep runtime-only config declarative with
!deferred,!require, and!assert. - Constructor Slots - Let config choose types and builders with dynamic tags like
!$(...). - Layered Vocabularies - Build a reusable config language in layers with
<<(<):. - Hybrid Pipelines - Compose Python callables, YAML templates, and partials into one pipeline.
- Higher-Order Config - Use config to manufacture configured callables, not just data.
More Patterns¶
- Dynamic Skeleton - You have M datasets and N configs. Without composition, that's M*N files. With the skeleton pattern, it's M+N.
- Weighted Registries - Define the full list once, then make variants by turning a few items up, down, or off.
- Config Templates - Repeated config blocks that differ by a few parameters. Parameterize them once, stamp them out.
- Sweep Generation - Generate experiment grids with
!eachand expressions instead of writing them by hand. - Composition Stack - Push, pop, and fork config layers at runtime for multi-phase pipelines.
- Anti-Patterns - Common mistakes and what to do instead.