So I recently learned that every .zig file comes with an automatically generated struct which has the same name as the .zig filename but where the file extension has been removed.
This reminds me of how in Java the public classes have the same name as the enclosing .java filename. In particular, the main function in both Java and Zig are alike in that the main function in Java is in a public class and the main function in Zig is in the enclosing file’s automatically generated struct.
In addition, this also means that any user created struct in Zig is more like a nested class in Java since it is already nested in the enclosing file’s struct.
Furthermore, by default, every member in Java’s public classes as well as in Zig’s enclosing files’ structs is private by default, inaccessible to anything outside of the public class or file struct, and in order to make the members public one needs to add a keyword (public in Java, pub in Zig) to make said member accessible to the rest of the world.