doc/ref: refine default values, references and evaluation
The current spec allows for an interpretation that makes default values not commutative:
A: *0 | 1
A: C - B
B: *0 | 1
B: C - A
C: 1
could evaluate to {A: 0, B: 1, C: 1} or {A: 1, B:0, C:1}
With the refined semantics, there is only one interpretation. Expressed in terms of value-default pairs:
A: (0|1 & 1-B, 0 & 1-B) => (0|1 & 1-B, _|_)
B: (0|1 & 1-A, 0 & 1-A) => (0|1 & 1-A, _|_)
C: 1
This updated spec also clarifies how references are resolved.
It also now officially allows an integer literal to be used as an index value.
Note there is now no point during evaluation anymore where a default value is taken over the regular value. Defaults are now only selected over another value when reading a configuration after full evaluation.
Change-Id: Iaea62a5d41c49889f4b5395027bab19e892f166b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/1784
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
authored by