Accepted talk at CONFLANG 2023 workshop -
The LIFE of CUE
Eloi Perdereau, Jacques Noye
We compare CUE and LIFE (actually a subset of these), two languages apparently far apart but which share some common roots.
CUE is an open source configuration language. It separates configuration from computation and represent configurations in a way inspired by typed feature structures, a concept inherited from computational linguistics. Feature structures can be seen as extensible records, where a record is simply a set of fields. A field is a pair (label, value) and a value is either a structure or an atom. A feature structure is extensible in that it is by default open and can be extended with new pairs. These feature structures can be ordered with respect to the information they carry. The resulting order is a lattice and two structures can be unified by computing their greatest lower bound in the lattice. Feature structures can additionally be typed using names organized in an inheritance hierarchy that contributes to the lattice. Atoms can be such names. In a given structure, coreferences can be used to make two substructures identical.
CUE diverges from the standard theory of typed feature structures in two ways: there is a single type for all structures, and coreferences are replaced by references. Whereas coreferenced feature structures coevolve through unification, referencing a feature structure creates a copy of the structure that may evolve independently from the initial structure.
LIFE is a language dedicated to symbolic computation that combines logic programming, functional programming, and object-oriented programming. Although it has apparently not much to do with CUE, it revolves around data structures, called psi-terms, which are an incarnation of typed feature structures. Each psi-term, like first-order terms, includes a functor that directly defines the type of the underlying feature structure. Also, new types can be introduced and type declarations may associate labels to functors. This complements the structural typing available in CUE with a form of nominal typing. Prolog-like variables are used to represent coreferences.
We elaborate on the commonalities and differences between building CUE configurations and LIFE psi-terms by relying on basic examples as well as sketches of operational semantics, considering a subset of CUE including embedded values and duplicate field declarations. Depending on the example, the mapping between CUE and LIFE can be straightforward or reveal serious discrepancies.
The most serious one is the use of references instead of coreferences. References are key because they allow a primitive form of inheritance akin to cloning. The reference can be seen as a clone of the referenced structure, which may then be further refined. As a programmer, getting an understanding of the meaning of a reference requires to collect and put together all the fields related to building the referenced structure. This is not always easy. It also creates complications when defining the building blocks of an operational semantics of CUE. Fortunately, CUE does not allow structural cycles, which alleviates the issue. Another discrepancy is that psi-terms can be annoyingly open. It is too easy to add unwanted labels to feature structures, including mere atoms.
We plan to further explore the commonalities and differences of these languages, in particular with respect to adding constraints to feature structures. It would also be worthwhile to look at some other languages based on typed feature structures to gain a better understanding of the design space. We conjecture that this understanding could lead to a theoretically-simpler configuration language, possibly extended with computational abilities.
Link to Workshop: https://2023.splashcon.org/home/conflang-2023/