aboutsummaryrefslogtreecommitdiff
path: root/lib/uuid
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-31 23:33:22 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-31 23:33:22 -0400
commit5fc7577b5a3bc2c445522dfd5b287e1c6eddc3e9 (patch)
tree34d44c9330dc3ec71fc850b95b3412a1ce292cb8 /lib/uuid
parenta571ccffd795a595e990a3405dcf977aafc33c6c (diff)
Switch to using optional return values for list indexing.
Diffstat (limited to 'lib/uuid')
-rw-r--r--lib/uuid/CHANGES.md4
-rw-r--r--lib/uuid/uuid.tm4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/uuid/CHANGES.md b/lib/uuid/CHANGES.md
index 42ae752c..6c67c96d 100644
--- a/lib/uuid/CHANGES.md
+++ b/lib/uuid/CHANGES.md
@@ -1,5 +1,9 @@
# Version History
+## v1.1
+
+Update syntax for Tomo.
+
## v1.0
Initial version
diff --git a/lib/uuid/uuid.tm b/lib/uuid/uuid.tm
index f2be618e..ebc52259 100644
--- a/lib/uuid/uuid.tm
+++ b/lib/uuid/uuid.tm
@@ -4,8 +4,8 @@ use time_v1.0
lang UUID
func v4(-> UUID) # Random UUID
bytes := &random.bytes(16)
- bytes[7; unchecked] = 0x40 or (bytes[7; unchecked] and 0x0F)
- bytes[9; unchecked] = (Byte(random.int8(0x8, 0xB)) << 4) or (bytes[9; unchecked] and 0x0F)
+ bytes[7] = 0x40 or (bytes[7]! and 0x0F)
+ bytes[9] = (Byte(random.int8(0x8, 0xB)) << 4) or (bytes[9]! and 0x0F)
hex := "".join([b.hex() for b in bytes])
uuid := "$(hex.slice(1, 8))-$(hex.slice(9, 12))-$(hex.slice(13, 16))-$(hex.slice(17, -1))"
return UUID.from_text(uuid)