diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-07 16:04:25 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-07 16:04:25 -0500 |
| commit | 37f3e91f6c95d46f161dbde05b0a005fe7e7c17a (patch) | |
| tree | c6e080ebbe7aed267b8ca0c5aec80fece51a5f65 /docs | |
| parent | a201939a8150bc4c2f221925797ea2751c74b77c (diff) | |
Rename "NONE" to "none"
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/arrays.md | 4 | ||||
| -rw-r--r-- | docs/booleans.md | 2 | ||||
| -rw-r--r-- | docs/integers.md | 6 | ||||
| -rw-r--r-- | docs/iterators.md | 2 | ||||
| -rw-r--r-- | docs/metamethods.md | 2 | ||||
| -rw-r--r-- | docs/moments.md | 4 | ||||
| -rw-r--r-- | docs/nums.md | 28 | ||||
| -rw-r--r-- | docs/optionals.md | 18 | ||||
| -rw-r--r-- | docs/paths.md | 4 | ||||
| -rw-r--r-- | docs/reductions.md | 2 | ||||
| -rw-r--r-- | docs/serialization.md | 2 | ||||
| -rw-r--r-- | docs/tables.md | 10 | ||||
| -rw-r--r-- | docs/text.md | 6 |
13 files changed, 45 insertions, 45 deletions
diff --git a/docs/arrays.md b/docs/arrays.md index c1886d43..efb108ba 100644 --- a/docs/arrays.md +++ b/docs/arrays.md @@ -366,7 +366,7 @@ The index of the first occurrence or `!Int` if not found. = 2 : Int? >> [10, 20, 30, 40, 50]:find(9999) -= NONE : Int? += none : Int? ``` --- @@ -396,7 +396,7 @@ item matches. >> [4, 5, 6]:find(func(i:&Int): i:is_prime()) = 5 : Int? >> [4, 6, 8]:find(func(i:&Int): i:is_prime()) -= NONE : Int? += none : Int? ``` --- diff --git a/docs/booleans.md b/docs/booleans.md index d2a22d5c..ab6be434 100644 --- a/docs/booleans.md +++ b/docs/booleans.md @@ -33,5 +33,5 @@ func parse(text: Text -> Bool?) >> Bool.parse("no") = no : Bool? >> Bool.parse("???") -= NONE : Bool? += none : Bool? ``` diff --git a/docs/integers.md b/docs/integers.md index c832949b..fe1fbc0c 100644 --- a/docs/integers.md +++ b/docs/integers.md @@ -220,7 +220,7 @@ func parse(text: Text -> Int?) **Returns:** The integer represented by the text. If the given text contains a value outside of the representable range or if the entire text can't be parsed as an integer, -`NONE` will be returned. +`none` will be returned. **Example:** ```tomo @@ -231,11 +231,11 @@ of the representable range or if the entire text can't be parsed as an integer, # Can't parse: >> Int.parse("asdf") -= NONE : Int? += none : Int? # Outside valid range: >> Int8.parse("9999999") -= NONE : Int8? += none : Int8? ``` --- diff --git a/docs/iterators.md b/docs/iterators.md index 064af9c2..ff7ed138 100644 --- a/docs/iterators.md +++ b/docs/iterators.md @@ -22,7 +22,7 @@ successively gets one line from a file at a time until the file is exhausted: >> iter() = "line three" : Text? >> iter() -= NONE : Text? += none : Text? for line in (./test.txt):each_line(): pass diff --git a/docs/metamethods.md b/docs/metamethods.md index a3f73b54..0983aff0 100644 --- a/docs/metamethods.md +++ b/docs/metamethods.md @@ -6,7 +6,7 @@ behavior that is required for all types: - `func as_text(obj:&T?, colorize=no, type:&TypeInfo_t -> Text)`: a method to convert the type to a string. If `colorize` is `yes`, then the method should include ANSI escape codes for syntax highlighting. If the `obj` pointer is - `NONE`, a string representation of the type will be returned instead. + `none`, a string representation of the type will be returned instead. - `func compare(x:&T, y:&T, type:&TypeInfo_t -> Int32)`: Return an integer representing the result of comparing `x` and `y`, where negative numbers mean `x` is less diff --git a/docs/moments.md b/docs/moments.md index 84b71d08..1cd26edb 100644 --- a/docs/moments.md +++ b/docs/moments.md @@ -523,7 +523,7 @@ Returns a `Moment` object representing the current date and time. **Description:** Return a new `Moment` object parsed from the given string in the given format, -or `NONE` if the value could not be successfully parsed. +or `none` if the value could not be successfully parsed. **Signature:** ```tomo @@ -539,7 +539,7 @@ func parse(text: Text, format: Text = "%Y-%m-%dT%H:%M:%S%z" -> Moment?) **Returns:** If the text was successfully parsed according to the given format, return a -`Moment` representing that information. Otherwise, return `NONE`. +`Moment` representing that information. Otherwise, return `none`. **Example:** ```tomo diff --git a/docs/nums.md b/docs/nums.md index 4a6b06de..b8d74592 100644 --- a/docs/nums.md +++ b/docs/nums.md @@ -26,7 +26,7 @@ differentiate between possibly-NaN values and definitely-not-NaN values. Tomo has a separate concept for expressing the lack of a defined value: optional types. Consequently, Tomo has merged these two concepts, so `NaN` is -called `NONE` and has the type `Num?` or `Num32?`. In this way, it's no +called `none` and has the type `Num?` or `Num32?`. In this way, it's no different from optional integers or optional arrays. This means that if a variable has type `Num`, it is guaranteed to not hold a NaN value. This also means that operations which may produce NaN values have a result type of @@ -36,9 +36,9 @@ values (zero times infinity), and many math functions like `sqrt()` can return NaN for some inputs. Unfortunately, one of the big downsides of optional types is that explicit -`NONE` handling can be very verbose. To make Nums actually usable, Tomo applies -very liberal use of type coercion and implicit `NONE` checks when values are -required to be non-NONE. Here are a few examples: +`none` handling can be very verbose. To make Nums actually usable, Tomo applies +very liberal use of type coercion and implicit `none` checks when values are +required to be non-none. Here are a few examples: ```tomo >> x := 0.0 @@ -46,17 +46,17 @@ required to be non-NONE. Here are a few examples: y := 1.0 -# Division might produce NONE: +# Division might produce none: >> x / y = 0 : Num? >> x / x -= NONE : Num? += none : Num? -# Optional types and NONE values propagate: +# Optional types and none values propagate: >> x/y + 1 + 2 = 3 : Num? >> x/x + 1 + 2 -= NONE : Num? += none : Num? # Optional Nums can be handled explicitly using `or` and `!`: >> x/x or -123 @@ -66,18 +66,18 @@ y := 1.0 >> (x/y)! = 0 : Num -# Assigning to a non-optional variable will do an implicit check for NONE and -# raise a runtime error if the value is NONE, essentially the same as an +# Assigning to a non-optional variable will do an implicit check for none and +# raise a runtime error if the value is none, essentially the same as an # implicit `!`: x = x/y func doop(x:Num -> Num): # If a function's return type is non-optional and an optional value is - # used in a return statement, an implicit NONE check will be inserted and - # will error if the value is NONE: + # used in a return statement, an implicit none check will be inserted and + # will error if the value is none: return x / 2 -# Function arguments are also implicitly checked for NONE if the given value +# Function arguments are also implicitly checked for none if the given value # is optional and the function needs a non-optional value: >> doop(x/y) = 0 : Num @@ -665,7 +665,7 @@ func parse(text: Text -> Num?) - `text`: The text containing the number. **Returns:** -The number represented by the text or `NONE` if the entire text can't be parsed +The number represented by the text or `none` if the entire text can't be parsed as a number. **Example:** diff --git a/docs/optionals.md b/docs/optionals.md index a0f54626..56b7ba16 100644 --- a/docs/optionals.md +++ b/docs/optionals.md @@ -35,12 +35,12 @@ Optional types are written using a `?` after the type name. So, an optional integer would be written as `Int?` and an optional array of texts would be written as `[Text]?`. -None can be written explicitly using `NONE` with a type annotation. For +None can be written explicitly using `none` with a type annotation. For example, if you wanted to declare a variable that could be either an integer -value or `NONE` and initialize it as none, you would write it as: +value or `none` and initialize it as none, you would write it as: ```tomo -x := NONE:Int +x := none:Int ``` Similarly, if you wanted to declare a variable that could be an array of texts @@ -51,7 +51,7 @@ x := ![Text] ``` If you want to declare a variable and initialize it with a non-none value, but -keep open the possibility of assigning `NONE` later, you can use the postfix +keep open the possibility of assigning `none` later, you can use the postfix `?` operator to indicate that a value is optional: ```tomo @@ -62,7 +62,7 @@ x = !Int ## Type Inference -For convenience, `NONE` can also be written without the explicit type +For convenience, `none` can also be written without the explicit type annotation for any type in situations where the compiler knows what type of optional value is expected: @@ -74,12 +74,12 @@ Here are some examples: ```tomo x := 5? -x = NONE +x = none func doop(arg:Int?)->Text?: - return NONE + return none -doop(NONE) +doop(none) ``` Non-none values can also be automatically promoted to optional values without @@ -97,7 +97,7 @@ doop(123) ## None Checking -In addition to using conditionals to check for `NONE`, you can also use `or` to +In addition to using conditionals to check for `none`, you can also use `or` to get a non-none value by either providing an alternative non-none value or by providing an early out statement like `return`/`skip`/`stop` or a function with an `Abort` type like `fail()` or `exit()`: diff --git a/docs/paths.md b/docs/paths.md index f2b44522..b6d62b61 100644 --- a/docs/paths.md +++ b/docs/paths.md @@ -495,7 +495,7 @@ raised. = "Hello" : Text? >> (./nosuchfile.xxx):read() -= NONE : Text? += none : Text? ``` --- @@ -524,7 +524,7 @@ returned. = [72[B], 101[B], 108[B], 108[B], 111[B]] : [Byte]? >> (./nosuchfile.xxx):read() -= NONE : [Byte]? += none : [Byte]? ``` --- diff --git a/docs/reductions.md b/docs/reductions.md index d68b3886..58cfa314 100644 --- a/docs/reductions.md +++ b/docs/reductions.md @@ -22,7 +22,7 @@ nums := [:Int] sum := (+: nums) >> sum -= NONE : Int? += none : Int? >> sum or 0 = 0 diff --git a/docs/serialization.md b/docs/serialization.md index ea21f900..764a6b27 100644 --- a/docs/serialization.md +++ b/docs/serialization.md @@ -52,7 +52,7 @@ cyclic datastructures correctly, enabling you to serialize cyclic structures like circularly linked lists or graphs: ```tomo -struct Cycle(name:Text, next=NONE:@Cycle) +struct Cycle(name:Text, next=none:@Cycle) c := @Cycle("A") c.next = @Cycle("B", next=c) diff --git a/docs/tables.md b/docs/tables.md index ef2333a7..a8a2793f 100644 --- a/docs/tables.md +++ b/docs/tables.md @@ -43,12 +43,12 @@ table := {"A": 1, "B": 2} >> table["A"] = 1 : Int? >> table["missing"] -= NONE : Int? += none : Int? ``` As with all optional values, you can use the `!` postfix operator to assert -that the value is non-NONE (and create a runtime error if it is), or you can -use the `or` operator to provide a fallback value in the case that it's NONE: +that the value is non-none (and create a runtime error if it is), or you can +use the `or` operator to provide a fallback value in the case that it's none: ```tomo >> table["A"]! @@ -77,7 +77,7 @@ table value: >> t2.fallback = {"A":10} : {Text:Int}? >> t.fallback -= NONE : {Text:Int}? += none : {Text:Int}? ``` ## Setting Values @@ -213,7 +213,7 @@ The value associated with the key or null if the key is not found. = 1 : Int? >> t:get("????") -= NONE : Int? += none : Int? >> t:get("A")! = 1 : Int diff --git a/docs/text.md b/docs/text.md index d67f0a7b..463a2336 100644 --- a/docs/text.md +++ b/docs/text.md @@ -695,9 +695,9 @@ containing information about the match. **Example:** ```tomo >> " #one #two #three ":find($/#{id}/, start=-999) -= NONE : Match? += none : Match? >> " #one #two #three ":find($/#{id}/, start=999) -= NONE : Match? += none : Match? >> " #one #two #three ":find($/#{id}/) = Match(text="#one", index=2, captures=["one"]) : Match? >> " #one #two #three ":find("{id}", start=6) @@ -887,7 +887,7 @@ or a null value otherwise. **Example:** ```tomo >> "hello world":matches($/{id}/) -= NONE : [Text]? += none : [Text]? >> "hello world":matches($/{id} {id}/) = ["hello", "world"] : [Text]? |
