From 5fc7577b5a3bc2c445522dfd5b287e1c6eddc3e9 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 31 Aug 2025 23:33:22 -0400 Subject: Switch to using optional return values for list indexing. --- lib/uuid/CHANGES.md | 4 ++++ lib/uuid/uuid.tm | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/uuid') 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) -- cgit v1.2.3