blob: 6af3c67ec6da3e2955f87f4295072e2a898d595e [file] [log] [blame] [view]
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01001[TOC](Readme.md) [Prev](disjunctions.md) [Next](disjstruct.md)
2
Marcel van Lohuizen3e592b42019-01-11 20:31:29 +01003_Types ~~and~~ are Values_
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01004
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01005# Default Values
6
Marcel van Lohuizene71fec62019-01-30 21:28:32 +01007Elements of a disjunction may be marked as preferred.
8If there is only one mark, or the users constraints a field enough such that
9only one mark remains, that value is the default value.
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010010
11In the example, `replicas` defaults to `1`.
12In the case of `protocol`, however, there are multiple definitions with
13different, mutually incompatible defaults.
Marcel van Lohuizene71fec62019-01-30 21:28:32 +010014In that case, both `"tcp"` and `"udp"` are preferred and one must explicitly
15specify either `"tcp"` or `"udp"` as if no marks were given.
16
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010017<!-- CUE editor -->
18```
19// any positive number, 1 is the default
Marcel van Lohuizenc9b3cb22019-01-30 11:32:41 +010020replicas: uint | *1
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010021
22// the default value is ambiguous
Marcel van Lohuizenc9b3cb22019-01-30 11:32:41 +010023protocol: *"tcp" | "udp"
24protocol: *"udp" | "tcp"
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010025```
26
27<!-- result -->
28```
29replicas: 1
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010030protocol: _|_
31```