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 stringdatabase.host = localhost
/= Hierarchical nestingdatabase = host = localhostThe dotted-key example creates Entry("database.host", "localhost"). The hierarchical example creates Entry("database", "host = localhost"); after build_hierarchy(), it becomes {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
/= Do not mix styles: this creates separate keysdatabase = host = localhostdatabase.port = 5432Implementation Note
Section titled “Implementation Note”Some implementations provide an opt-in expand_dotted function that rewrites dotted keys into nested structures. This is experimental and tracked under the experimental_dotted_keys feature tag. Standard typed accessors (get_string, get_int, etc.) take separate path segments; they do not interpret "a.b" as a path.