I enjoy Electronics design & prototyping, C programming, Linux, IT,
Also music creation (Soundtracks for Film/TV/Games) which I stream on [Twitch](https://twitch.tv/deltomix)
Super helpful to see both an actual example of "zig imports files as structs" and a clear concise zig implementation of a familiar data structure.
The @import documentation mentions "Zig source files are implicitly structs" but its great to see an actual example!
Except (correct me if I'm wrong) with the bare struct contents separated into Node.zig - "Node" no longer has a declaration as the type, so for that to work wouldn't Node.zig then need to become;
data:u8,left:?*@This(),right:?*@This(),
Or, with a 'Self' element and also using your defaults example;
Super helpful to see both an actual example of "zig imports files as structs" and a clear concise zig implementation of a familiar data structure.
The @import documentation mentions "Zig source files are implicitly structs" but its great to see an actual example!
Except (correct me if I'm wrong) with the bare struct contents separated into
Node.zig
- "Node" no longer has a declaration as the type, so for that to work wouldn'tNode.zig
then need to become;Or, with a 'Self' element and also using your defaults example;
Also on that final main.zig snippet I found I needed to include the file name extension in the @import target;
Wondering if maybe I should have done something in the generated build.zig ?
Thanks for the feedback! I fixed some of the things you pointed out.
I finally got around to compiling all the code and the final working stuff should be on the GitHub linked in the second post.