doc/ref: remove ranges from spec
With the addition of unary operators, ranges are superfluous.
Advantages:
- less things to learn
- removes a level of operator precedence
- removes an operator
- removes somewhat complicated semantics
for ranges of two different types
Change-Id: Ia705bf578ef5a5d2a49620b2cfc5190c881d1b06
diff --git a/doc/tutorial/basics/lists.md b/doc/tutorial/basics/lists.md
index f583308..dd1889f 100644
--- a/doc/tutorial/basics/lists.md
+++ b/doc/tutorial/basics/lists.md
@@ -10,7 +10,7 @@
additional, possibly typed elements.
In the example we define `IP` to be a list of `4` elements of type `uint8`, which
-is a predeclared value of `0..255`.
+is a predeclared value of `>=0 & <=255`.
`PrivateIP` defines the IP ranges defined for private use.
Note that as it is already defined to be an `IP`, the length of the list
is already fixed at `4` and we do not have to specify a value for all elements.
@@ -25,7 +25,7 @@
IP: 4 * [ uint8 ]
PrivateIP: IP
-PrivateIP: [10, ...uint8] | [192, 168, ...] | [172, 16..32, ...]
+PrivateIP: [10, ...uint8] | [192, 168, ...] | [172, >=16 & <=32, ...]
myIP: PrivateIP
myIP: [10, 2, 3, 4]
@@ -36,11 +36,11 @@
<!-- result -->
```
-IP: [0..255, 0..255, 0..255, 0..255]
+IP: [>=0 & <=255, >=0 & <=255, >=0 & <=255, >=0 & <=255]
PrivateIP:
- [10, 0..255, 0..255, 0..255] |
- [192, 168, 0..255, 0..255] |
- [172, 16..32, 0..255, 0..255]
+ [10, >=0 & <=255, >=0 & <=255, >=0 & <=255] |
+ [192, 168, >=0 & <=255, >=0 & <=255] |
+ [172, >=16 & <=32, >=0 & <=255, >=0 & <=255]
myIP: [10, 2, 3, 4]
yourIP: _|_
diff --git a/doc/tutorial/basics/rangedef.md b/doc/tutorial/basics/rangedef.md
index 39da35b..7553558 100644
--- a/doc/tutorial/basics/rangedef.md
+++ b/doc/tutorial/basics/rangedef.md
@@ -11,19 +11,19 @@
integers to common values.
```
-uint 0..int
-uint8 0..255
-int8 -128..127
-uint16 0..65536
-int16 -32_768...32_767
-rune 0..0x10FFFF
-uint32 0..4_294_967_296
-int32 -2_147_483_648..2_147_483_647
-uint64 0..18_446_744_073_709_551_615
-int64 -9_223_372_036_854_775_808..9_223_372_036_854_775_807
-int128 -170_141_183_460_469_231_731_687_303_715_884_105_728..
- 170_141_183_460_469_231_731_687_303_715_884_105_727
-uint128 0..340_282_366_920_938_463_463_374_607_431_768_211_455
+uint >=0
+uint8 >=0 & <=255
+int8 >=-128 & <=127
+uint16 >=0 & <=65536
+int16 >=-32_768 & <=.32_767
+rune >=0 & <=0x10FFFF
+uint32 >=0 & <=4_294_967_296
+int32 >=-2_147_483_648 & <=2_147_483_647
+uint64 >=0 & <=18_446_744_073_709_551_615
+int64 >=-9_223_372_036_854_775_808 & <=9_223_372_036_854_775_807
+int128 >=-170_141_183_460_469_231_731_687_303_715_884_105_728 &
+ <=170_141_183_460_469_231_731_687_303_715_884_105_727
+uint128 >=0 & <=340_282_366_920_938_463_463_374_607_431_768_211_455
```
<!-- CUE editor -->
diff --git a/doc/tutorial/basics/ranges.md b/doc/tutorial/basics/ranges.md
index da50c1c..548845b 100644
--- a/doc/tutorial/basics/ranges.md
+++ b/doc/tutorial/basics/ranges.md
@@ -2,23 +2,22 @@
_Types ~~and~~ are Values_
-# Ranges
+# Bounds
-Ranges define an inclusive range of valid values.
-They work on numbers, strings, and bytes.
+Bounds define a lower bound, upper bound, or inequality for a certain value.
+They work on numbers, strings, bytes, and and null.
-The type of a range is the unification of the types of the start and end
-value.
-
-Unifying two ranges results in the overlapping range or an error if there
-is no overlap.
+The bound is defined for all values for which the corresponding comparison
+operation is define.
+For instance `>5.0` allows all floating point values greater than `5.0`,
+whereas `<0` allows all negative numbers (int or float).
<!-- CUE editor -->
```
-rn: 3..5 // type int | float
-ri: 3..5 & int // type int
-rf: 3..5.0 // type float
-rs: "a".."mo"
+rn: >=3 & <8 // type int | float
+ri: >=3 & <8 & int // type int
+rf: >=3 & <=8.0 // type float
+rs: >="a" & <"mo"
{
a: rn & 3.5
@@ -27,7 +26,7 @@
d: rs & "ma"
e: rs & "mu"
- r1: 0..7 & 3..10
+ r1: rn & >=5 & <10
}
```
@@ -38,5 +37,5 @@
c: 3.0
d: "ma"
e: _|_
-r1: 3..7
+r1: >=5 & <8
```