Marcel van Lohuizen | af0932f | 2019-01-11 13:03:56 +0100 | [diff] [blame] | 1 | [TOC](Readme.md) [Prev](disjunctions.md) [Next](disjstruct.md) |
| 2 | |
Marcel van Lohuizen | 3e592b4 | 2019-01-11 20:31:29 +0100 | [diff] [blame] | 3 | _Types ~~and~~ are Values_ |
Marcel van Lohuizen | af0932f | 2019-01-11 13:03:56 +0100 | [diff] [blame] | 4 | |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 5 | # Default Values |
| 6 | |
Marcel van Lohuizen | e71fec6 | 2019-01-30 21:28:32 +0100 | [diff] [blame] | 7 | Elements of a disjunction may be marked as preferred. |
| 8 | If there is only one mark, or the users constraints a field enough such that |
| 9 | only one mark remains, that value is the default value. |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 10 | |
| 11 | In the example, `replicas` defaults to `1`. |
| 12 | In the case of `protocol`, however, there are multiple definitions with |
| 13 | different, mutually incompatible defaults. |
Marcel van Lohuizen | e71fec6 | 2019-01-30 21:28:32 +0100 | [diff] [blame] | 14 | In that case, both `"tcp"` and `"udp"` are preferred and one must explicitly |
| 15 | specify either `"tcp"` or `"udp"` as if no marks were given. |
| 16 | |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 17 | <!-- CUE editor --> |
| 18 | ``` |
| 19 | // any positive number, 1 is the default |
Marcel van Lohuizen | c9b3cb2 | 2019-01-30 11:32:41 +0100 | [diff] [blame] | 20 | replicas: uint | *1 |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 21 | |
| 22 | // the default value is ambiguous |
Marcel van Lohuizen | c9b3cb2 | 2019-01-30 11:32:41 +0100 | [diff] [blame] | 23 | protocol: *"tcp" | "udp" |
| 24 | protocol: *"udp" | "tcp" |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 25 | ``` |
| 26 | |
| 27 | <!-- result --> |
| 28 | ``` |
| 29 | replicas: 1 |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 30 | protocol: _|_ |
| 31 | ``` |