Dotted Keys Explained
In CCL, dotted keys are literal string keys containing dots, not shorthand for nested structures.
The Core Distinction
Section titled “The Core Distinction”These create different data structures:
# Dotted key (literal string)database.host = localhost→ Entry("database.host", "localhost")
# Hierarchical nestingdatabase = host = localhost→ Entry("database", "host = localhost")→ After build_hierarchy(): {database: {host: "localhost"}}Access Patterns
Section titled “Access Patterns”Dotted keys use the literal string:
get_string(config, "database.host") // ✓ Worksget_string(config, "database", "host") // ❌ No nested objectHierarchical data uses nested access:
get_string(config, "database", "host") // ✓ Worksget_string(config, "database.host") // ❌ No literal keyBest Practice: Choose One Style
Section titled “Best Practice: Choose One Style”# ✓ Hierarchical (recommended)database = host = localhost port = 5432
# ✓ Dotted keysdatabase.host = localhostdatabase.port = 5432
# ❌ Don't mix - creates separate keysdatabase = host = localhostdatabase.port = 5432 # Different key!Implementation Note
Section titled “Implementation Note”Some implementations provide dotted representation - allowing dotted access to hierarchical data. This is experimental and optional. Check your implementation’s documentation.