From 0fa9a52090eb5d9ce88220c0134a8d2af6eb8d94 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 23 Nov 2025 13:28:48 -0500 Subject: Accessing enum fields now gives an optional value instead of a boolean --- src/stdlib/datatypes.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/stdlib/datatypes.h') diff --git a/src/stdlib/datatypes.h b/src/stdlib/datatypes.h index caabdacd..d51db8ab 100644 --- a/src/stdlib/datatypes.h +++ b/src/stdlib/datatypes.h @@ -72,11 +72,16 @@ typedef struct table_s { typedef struct Empty$$struct { } Empty$$type; +#define EMPTY_STRUCT ((Empty$$type){}) + typedef struct { bool has_value; Empty$$type value; } $OptionalEmpty$$type; +#define NONE_EMPTY_STRUCT (($OptionalEmpty$$type){.has_value = false}) +#define OPTIONAL_EMPTY_STRUCT (($OptionalEmpty$$type){.has_value = true}) + typedef struct { void *fn, *userdata; } Closure_t; -- cgit v1.2.3