From 77696e19c9575185654c5ee9d3275d2516955ab2 Mon Sep 17 00:00:00 2001 From: hl-valdemar Date: Wed, 22 Jul 2026 00:48:44 +0200 Subject: [PATCH] rename none to null --- std/debug/debug.hon | 2 +- std/enums/enums.hon | 4 ++-- std/enums/enums.test.hon | 2 +- std/hashmap/hashmap.hon | 4 ++-- std/io/file.hon | 2 +- std/mem/mem.hon | 18 +++++++++--------- std/meta/meta.hon | 1 + std/meta/meta.test.hon | 2 +- std/testing/testing.hon | 4 ++-- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/std/debug/debug.hon b/std/debug/debug.hon index edb7e87..fa1f863 100644 --- a/std/debug/debug.hon +++ b/std/debug/debug.hon @@ -3,7 +3,7 @@ import "@std/io" print func($format []u8, $Args type, args Args) void { writer io.Writer :: io.Writer{ - context = none, + context = null, handle = io.Handle{ file_desc = c_int(io.Stream.stderr) }, write = write, } diff --git a/std/enums/enums.hon b/std/enums/enums.hon index 7e1b2e4..d6a2624 100644 --- a/std/enums/enums.hon +++ b/std/enums/enums.hon @@ -12,7 +12,7 @@ EnumMap func($E, $V type) type { init func( $E, $V type, - values meta.EnumFieldStruct(E, ?V, some!(none)), + values meta.EnumFieldStruct(E, ?V, some!(null)), ) EnumMap(E, V) { map EnumMap(E, V) = undefined @@ -37,7 +37,7 @@ get func($E, $V type, map @EnumMap(E, V), key E) ?V { .enum |info|: expand for info.fields |field, i| { if key == field!(E, field.name) { if (map.present[i]) return map.values[i] - return none + return null } } else: compile_error!("EnumMap key must be an enum") diff --git a/std/enums/enums.test.hon b/std/enums/enums.test.hon index ba4a2b8..d50441a 100644 --- a/std/enums/enums.test.hon +++ b/std/enums/enums.test.hon @@ -21,5 +21,5 @@ handles_sparse_enum_get test { eof :: get(&names, TestEnum.eof) try testing.expect_type(?[]u8, eof) - try testing.expect_equal(none, eof) + try testing.expect_equal(null, eof) } diff --git a/std/hashmap/hashmap.hon b/std/hashmap/hashmap.hon index dbc6e2d..6141049 100644 --- a/std/hashmap/hashmap.hon +++ b/std/hashmap/hashmap.hon @@ -56,14 +56,14 @@ get func( map @HashMap(K, V, hash_key, keys_eql), key K, ) ?V { - if (map.count == 0) return none + if (map.count == 0) return null hash :: normalize(hash_key(key)) idx usize = hash & (map.entries.len - 1) while true { entry :: map.entries[idx] - if (entry.hash == 0) return none + if (entry.hash == 0) return null if (entry.hash == hash and keys_eql(entry.key, key)) { return entry.value diff --git a/std/io/file.hon b/std/io/file.hon index 9e98b05..e1a37aa 100644 --- a/std/io/file.hon +++ b/std/io/file.hon @@ -138,7 +138,7 @@ hide system_vtable IoVTable :: IoVTable { hide system func() Io { return Io { - context = none, + context = null, vtable = &system_vtable, } } diff --git a/std/mem/mem.hon b/std/mem/mem.hon index e43af77..b1d2d03 100644 --- a/std/mem/mem.hon +++ b/std/mem/mem.hon @@ -84,7 +84,7 @@ realloc func($T type, allocator Allocator, memory []mut T, new_count usize) []mu return .out_of_memory } - old_memory ?*mut u8 = none + old_memory ?*mut u8 = null old_size usize = 0 if memory.len != 0 { old_memory = ptrcast!(u8, memory.ptr) @@ -147,17 +147,17 @@ hide power_of_two func(value usize) bool { hide c_alloc func(_ ?@mut anyopaque, size usize, alignment usize) ?*mut u8 { if power_of_two(alignment) == false { - return none + return null } if alignment <= malloc_alignment { return ptrcast!(u8, c.malloc(c_ulong(size))) } - memory [1]mut ?*mut anyopaque = [none] + memory [1]mut ?*mut anyopaque = [null] status c_int = c.posix_memalign((&memory).ptr, c_ulong(alignment), c_ulong(size)) if status != 0 { - return none + return null } return ptrcast!(u8, memory[0]) @@ -165,12 +165,12 @@ hide c_alloc func(_ ?@mut anyopaque, size usize, alignment usize) ?*mut u8 { hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 { if power_of_two(alignment) == false { - return none + return null } if new_size == 0 { c.free(memory) - return none + return null } if memory |old_memory| { @@ -178,7 +178,7 @@ hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size return ptrcast!(u8, c.realloc(old_memory, c_ulong(new_size))) } - new_memory ?*mut u8 = c_alloc(none, new_size, alignment) + new_memory ?*mut u8 = c_alloc(null, new_size, alignment) if new_memory |new_bytes| { copy_size usize = old_size if new_size < copy_size { @@ -190,7 +190,7 @@ hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size return new_memory } - return c_alloc(none, new_size, alignment) + return c_alloc(null, new_size, alignment) } hide c_free func(_ ?@mut anyopaque, memory ?*mut u8, _ usize, _ usize) void { @@ -204,6 +204,6 @@ hide c_vtable AllocatorVTable :: AllocatorVTable { } c_allocator Allocator :: Allocator { - context = none, + context = null, vtable = &c_vtable, } diff --git a/std/meta/meta.hon b/std/meta/meta.hon index f6a39d6..5780e89 100644 --- a/std/meta/meta.hon +++ b/std/meta/meta.hon @@ -23,6 +23,7 @@ EnumInfo :: struct { TypeInfo :: union(enum) { invalid void void void + noreturn void anyopaque void bool void integer void diff --git a/std/meta/meta.test.hon b/std/meta/meta.test.hon index 1c357a2..a0d64b2 100644 --- a/std/meta/meta.test.hon +++ b/std/meta/meta.test.hon @@ -6,7 +6,7 @@ TestTokenKind :: enum(u8) { eof = 21 } -TestNames :: alias EnumFieldStruct(TestTokenKind, ?[]u8, some!(none)) +TestNames :: alias EnumFieldStruct(TestTokenKind, ?[]u8, some!(null)) enum_field_struct_defaults test { names TestNames = { diff --git a/std/testing/testing.hon b/std/testing/testing.hon index 918e4d8..964dab3 100644 --- a/std/testing/testing.hon +++ b/std/testing/testing.hon @@ -26,11 +26,11 @@ expect_equal func($T type, expected, actual T, location SourceLocation) void ! E try expect_equal(expected_value, actual_value, location) return } - debug.print("{s}:{d}:{d}: expected an optional value, found none\n", {location.file, location.line, location.column}) + debug.print("{s}:{d}:{d}: expected an optional value, found null\n", {location.file, location.line, location.column}) return .expectation_failed } if actual |_| { - debug.print("{s}:{d}:{d}: expected none, found an optional value\n", {location.file, location.line, location.column}) + debug.print("{s}:{d}:{d}: expected null, found an optional value\n", {location.file, location.line, location.column}) return .expectation_failed } }