Closed
Description
Extracted from #14523.
Given a foo.zon file:
.{
.bar = "hello",
}
it should be possible to @import
it as a comptime-known value:
const data = @import("foo.zon");
comptime {
assert(std.mem.eql(u8, data.bar, "hello"));
}
One motivating use case in particular is, inside build.zig, one should be able to @import("build.zig.zon")
and access those values.
Note that the top level expression of a zon file is not necessarily an anonymous struct literal. It can be:
- string literal
- boolean literal
- integer literal
- null literal
- undefined literal
- anonymous struct literal
- tuple literal
- anonymous enum literal