Design Notes
Source:DESIGN.md
This document records architectural priorities for grrr so they are not lost.
10 Design Points
- Tree-first model
- Treat every graphic as a scene tree (AST), not a one-shot imperative draw sequence.
- Atomic vs compound nodes
- Keep a strict split between leaf drawables (
grab_atom) and structural/group nodes (grab_bag).
- Late expansion
- Expand compound nodes to backend primitives only at rendering/lowering time.
- Explicit coordinate spaces
- Every node declares its coordinate space (for example
data,panel,local,device).
- Explicit transforms
- Every node carries a transform payload so nested placement is deterministic and inspectable.
- Stable node identity
- Nodes have stable IDs suitable for diffing, targeted updates, caching, and interaction.
- Style inheritance as data
- Inherited aesthetics are merged branch-wise and treated as explicit render state.
- Deterministic traversal and passes
- Rendering proceeds through explicit, deterministic passes rather than hidden side effects.
- Dirty tracking and caching
- Nodes can be marked dirty, and render/style computation may be cached across passes.
- Versioned scene schema
- Scene AST is serializable with explicit schema versioning for portability and migration.
Implementation Roadmap (for grrr)
Scope note: grrr should focus on scene representation and rendering infrastructure; high-level plot grammar construction belongs to bridge packages (for example ggplot-oriented tooling), not grrr core.
- Formalize spaces and transforms
- Add
coordinate_spaceandtransformto all nodes.
- Add stable IDs and deterministic traversal
- Add
node_idto nodes and provide deterministic path-based assignment.
- Implement explicit rendering passes
- Use prepare/plan/emit rendering stages.
- Add style cache + dirty tracking
- Cache merged branch styles with dirty-aware invalidation.
- Add versioned scene schema and serializers
- Provide list/json/yaml serialization with schema metadata.