CUE: Another interesting configuration language


#1

This one just popped up on HN: https://cuelang.org/

There’s a nice page on the theoretical background: https://cuelang.org/docs/concepts/logic/

…and a spec: https://github.com/cuelang/cue/blob/master/doc/ref/spec.md

The constraint system seems pretty nice for validations. Defaults look super easy too. OTOH it appears that one cannot define functions, and I haven’t seen anything like Dhall’s import system for code sharing.


#2

Looking at where CUE excels, it seems to be strongest in schema definition and validation. For instance, their data validation documentation points out that CUE allows you to verify that two fields are equivalent, and that numbers fall within a certain range. The frontpage has a demonstration video showing the use of a regex to validate the contents of a string.

Given that I don’t see Dhall implementing data-level validation like that anytime soon (never say never?), I guess the operative question is - can Dhall be used to generate CUE definition files, i.e. a dhall-cue project? Then a Dhall expression could generate a CUE definition file along with a proposed JSON or YAML file to be verified, and the user can glue in a CUE verification after Dhall has generated the proposed configuration (or perhaps before, to verify input records for Dhall functions).


#3

I wouldn’t worry too much about technical comparisons at this point. What’s going to differentiate adoption of languages like Jsonnet/Dhall/Cue are the “complete experience” they provide (e.g. integrations, ease of installation, documentation, available packages, support/knowledge-base, well-developed use-cases, etc.)

However, even addressing the technical aspects the main issue I see with Cue is that it doesn’t really improve much on Jsonnet + JSON schema. There are only a few minor things that its validation system can do that JSON schema cannot do. For example, JSON schema can handle regex-based validation, minimum/maximum values, and untagged unions, too.