Comprehensive guides to meta-programming, reflection, code generation, and WASM compilation in Metal DOL
This tutorial collection demonstrates all meta-programming capabilities in DOL, from runtime reflection to multi-language code generation to full WASM deployment pipelines.
-
Runtime Reflection - Query schemas at runtime using
dol-reflect- TypeRegistry and TypeInfo API
- Dynamic schema introspection
- Hot-reload patterns
- CRDT strategy inspection
- Level: Intermediate | Lines: 150+
-
Multi-Target Code Generation - Generate Rust, TypeScript, Python, WIT, JSON Schema
- All 5 code generation targets
- Template customization
- Build system integration
- Level: Intermediate | Lines: 180+
-
AI-Assisted Schema Design - Natural language to DOL
- MCP tool integration
- LSP intelligent completion
- Schema validation with AI
- Level: Advanced | Lines: 120+
-
Declarative Macros - Pattern matching and hygienic expansion
- Built-in macros (derive, stringify, concat)
- Custom macro creation
- Macro hygiene rules
- Level: Intermediate | Lines: 140+
-
Procedural Macros - Advanced code transformation
- Derive macros (Debug, Clone, Gen)
- Attribute macros (cached, async, memoize)
- Function-like macros (sql, json, regex)
- Level: Advanced | Lines: 160+
-
DOL to WASM Pipeline - Full compilation workflow
- DOL → Rust → WASM compilation
- CRDT annotations in WASM
- wasm-opt optimization
- Browser and Node.js integration
- Level: Intermediate | Lines: 220+
-
CRDT Schema Design - Local-first patterns
- All 7 CRDT strategies with examples
- Type compatibility guide
- Constraint + CRDT interaction
- Merge behavior patterns
- Level: Advanced | Lines: 170+
-
Advanced Reflection Patterns - Meta-programming techniques
- Runtime schema evolution
- Generic programming with reflection
- Type-safe serialization
- Self-modifying programs
- Level: Expert | Lines: 160+
-
Multi-Language Workflow - Cross-platform development
- Single schema → 5 languages
- Build automation (Makefile, scripts)
- Package manager integration
- Level: Intermediate | Lines: 190+
-
Production Deployment - Going to production
- WASM bundle optimization
- Performance profiling
- CI/CD pipelines
- Monitoring and debugging
- Level: Advanced | Lines: 210+
01 → 04 → 06 → 10
Start with reflection basics, learn macros, compile to WASM, deploy to production.
01 → 04 → 05 → 08
Master reflection, declarative macros, procedural macros, advanced patterns.
01 → 07 → 06 → 09
Understand reflection, design CRDT schemas, compile to WASM, deploy multi-platform.
02 → 09 → 06 → 10
Generate code for all targets, automate builds, compile to WASM, production deployment.
# Required
rustc >= 1.70.0
cargo >= 1.70.0
wasm-pack >= 0.12.0
# Optional (for specific tutorials)
node >= 18.0.0 # Tutorial 06, 09
python >= 3.10 # Tutorial 02, 09
deno >= 1.30.0 # Tutorial 06
wasmtime >= 15.0.0 # Tutorial 06# Install DOL from source
git clone https://github.com/univrs/dol
cd dol
cargo install --path .
# Verify installation
dol --versionAll tutorials reference example files in Meta-Tutorials/Examples/:
- 20+ DOL schemas demonstrating all features
- Build scripts and automation
- Test harnesses
# Clone and navigate
cd Meta-Tutorials
# Run a simple example
cd Examples
dol-codegen --target rust user_profile.dol > user_profile.rs
# Compile to WASM
dol-build-wasm chat_room.dol| Feature | Tutorials | Examples |
|---|---|---|
| Runtime Reflection | 01, 08 | 5+ |
| Code Generation | 02, 09 | 8+ |
| Declarative Macros | 04 | 6+ |
| Procedural Macros | 05 | 5+ |
| WASM Compilation | 06, 10 | 7+ |
| CRDT Strategies | 07 | 7+ |
| AI Integration | 03 | 3+ |
Each tutorial follows this structure:
- Overview: What you'll learn and prerequisites
- Concepts: Core concepts explained
- Complete Examples: 100-200+ lines of working code
- Step-by-Step Walkthrough: Detailed explanations
- Common Pitfalls: What to avoid
- Performance Tips: Optimization strategies
- Further Reading: Related resources
// DOL code is syntax-highlighted
gen Example {
has field: Type
}
// Rust code examples are complete and runnable
fn example() {
println!("Working code");
}# Shell commands are prefixed with $
$ dol-codegen example.dol- Beginner: Basic DOL knowledge required
- Intermediate: Familiar with DOL syntax and concepts
- Advanced: Deep understanding of type systems
- Expert: Meta-programming experience
Found an issue or want to improve a tutorial?
# Open an issue
https://github.com/univrs/dol/issues
# Submit a PR
git checkout -b improve-tutorial-01
# Make changes
git commit -m "Improve Tutorial 01 with XYZ"
git push origin improve-tutorial-01By completing these tutorials, you'll build:
- Reflection Engine - Runtime schema browser (Tutorial 01)
- Code Generator - Multi-language output (Tutorial 02)
- Schema Designer - AI-assisted tool (Tutorial 03)
- Macro Library - Custom macros (Tutorials 04-05)
- WASM Chat App - Real-time collaboration (Tutorial 06)
- CRDT Editor - Conflict-free text editing (Tutorial 07)
- Type-Safe Serializer - Reflection-based (Tutorial 08)
- Polyglot SDK - One schema, many languages (Tutorial 09)
- Production Service - Deployed WASM microservice (Tutorial 10)
- Total Lines of Code: 1,700+
- Example Schemas: 20+
- Runnable Examples: 50+
- Build Scripts: 10+
- Test Cases: 30+
- Start with Tutorial 01: Runtime Reflection
- Follow your chosen learning path
- Build the example projects
- Contribute back to the community
Last Updated: 2026-02-07 DOL Version: 0.8.0+ Maintainer: Univrs Team