Re:When Zig is safer and faster than Rust
by foldr on Tuesday March 07, 2023 @04:54PM
(#35061811)
It doesn't let you drop redundant struct tags, as far as I can tell.
[ Parent
| on HN ]
Re:When Zig is safer and faster than Rust
by tialaramex on Tuesday March 07, 2023 @08:17PM
(#35063895)
I think you're right, although mentioning a macro does suggest another option here, you could write a macro which transforms [{foo1, "bar1", baz1}, {foo2, "bar2", baz2}] into the named structure version.
Since it's a macro there's no impact on runtime performance, but on the other hand it's more work to debug it. Learning declarative macros in Rust is much nicer and safer than learning C macros, but nowhere near as powerful as Rust's horribly unsafe proc macros.