diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 22:45:02 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 22:45:02 -0400 |
| commit | 44cd26f2cebd760a53aa4ff1b7779e718a101650 (patch) | |
| tree | 4bdc9144c6825a0c394155712d5e464ee2a61061 /docs/optionals.md | |
| parent | 3406515a44b13d0c290c28ac42bd364ce27560c7 (diff) | |
Rename Array -> List in all code and docs
Diffstat (limited to 'docs/optionals.md')
| -rw-r--r-- | docs/optionals.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/optionals.md b/docs/optionals.md index 7b100dc7..48e48875 100644 --- a/docs/optionals.md +++ b/docs/optionals.md @@ -32,7 +32,7 @@ conventions and which would generate a lot of unnecessary code. ## Syntax 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 +integer would be written as `Int?` and an optional list of texts would be written as `[Text]?`. None can be written explicitly using `none` with a type annotation. For @@ -43,7 +43,7 @@ value or `none` and initialize it as none, you would write it as: x : Int = none ``` -Similarly, if you wanted to declare a variable that could be an array of texts +Similarly, if you wanted to declare a variable that could be a list of texts or none and initialize it as none, you would write: ```tomo @@ -127,10 +127,10 @@ for line in lines: ## Implementation Notes The implementation of optional types is highly efficient and has no memory -overhead for pointers, collection types (arrays, sets, tables), booleans, +overhead for pointers, collection types (lists, sets, tables), booleans, texts, enums, nums, or integers (`Int` type only). This is done by using carefully chosen values, such as `0` for pointers, `2` for booleans, or a -negative length for arrays. However, for fixed-size integers (`Int64`, `Int32`, +negative length for lists. However, for fixed-size integers (`Int64`, `Int32`, `Int16`, and `Int8`), bytes, and structs, an additional byte is required for out-of-band information about whether the value is none or not. |
