default struct fields

This commit is contained in:
2026-07-18 16:23:47 +02:00
parent e889a99e55
commit 9eb7476522
10 changed files with 191 additions and 11 deletions
+10 -3
View File
@@ -731,8 +731,8 @@
- enabled `&<array literal>` (Zig's `&.{...}`): the literal is promoted to an
anonymous global whose address decays to a slice, so list fields like
`libraries = &["raylib"]` work; empty lists are `&[]`
- deferred: build graph / steps / caching, multiple artifacts, computed paths
(needs string building), struct field defaults to drop `&[]` on empty lists
- deferred: build graph / steps / caching, multiple artifacts, and computed paths
(needs string building); milestone 44 later removed explicit `&[]` build-config fields
29. fix bugs (implemented)
- bare `return` is the empty return for void functions; `yield` always requires a
@@ -925,7 +925,14 @@
- runtime pointer contexts implicitly materialize a bare identity; pointer-to-identity conversion is
rejected, and bare-containing aggregates cannot enter runtime storage or ABI/C layouts
44. struct field defaults on declaration
44. struct field defaults on declaration (implemented)
- named native structs accept `field T = expression`; keyed construction evaluates defaults
for omitted fields while explicit initializers override them
- defaults resolve names in the declaration file, participate in record constraint inference,
and work during runtime and comptime construction
- `@std/build.BuildConfig` uses defaults for optional list fields
- fields without defaults remain required; C-layout records, unions, tuples, and anonymous
generated structs do not accept defaults
## A word on unchecked casts