Why not a general purpose language? #1254
-
Hi 👋 ! I've discovered recently Cue and found it very exciting. I'm 100% convinced that managing json or yaml by hand is not the way to go. But why not use a general purpose language for managing our data? What are the arguments of using Cue instead of a general purpose which already has a lot of tooling in place like unit-tests, a package manager,…? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Because configuration is its own animal so to speak. And configuration is more readable, writable, composable, testable, maintainable, etc, when it is declarative rather than imperative. Using general purpose languages (GPL) for managing config is notoriously prone to unintended and unexpected side effects. To be clear I'm talking about config like yaml for kubernetes or json for cloudformation. Writing a recommendation engine that performs singular value decomposition on a matrix of data is a completely different thing that truly warrants a full on programming language (such as Python, Go, or R). So when we talk about CUE we are talking about the data used for configuration CUE: Configure · Unify · Execute <-- it's even in the name! CUE solves the pitfalls of GPLs by:
This allows for both the defining of a schema AND enforcing of a schema. Doing both with a general purpose language is actually much harder and verbose than it is with CUE. It also results in very composable, modular, easy to maintain, code base that reduces or even eliminates unintended, unexpected side effects. It's worth noting that Marcel, the creator of CUE, spent many years writing more general configuration languages at Google such as GCL and learned many lessons the hard way. CUE is an approach intended to avoid the pitfalls of common general purpose languages. |
Beta Was this translation helpful? Give feedback.
Because configuration is its own animal so to speak. And configuration is more readable, writable, composable, testable, maintainable, etc, when it is declarative rather than imperative. Using general purpose languages (GPL) for managing config is notoriously prone to unintended and unexpected side effects. To be clear I'm talking about config like yaml for kubernetes or json for cloudformation. Writing a recommendation engine that performs singular value decomposition on a matrix of data is a completely different thing that truly warrants a full on programming language (such as Python, Go, or R). So when we talk about CUE we are talking about the data used for configuration
CUE: Configur…