Coming from other languages it felt natural to write a file like this:
------ Duck.zig
pub const Duck = struct {
const can_migrate: bool = false;
quack_count: u32,
pub fn quack(self: *Duck) { ... }
}
I realized I didn't have to do the struct at all since @import returns a struct anyway:
------ Duck.zig
const Self = @This();
const can_migrate: bool = false;
quack_count: u32,
pub fn quack(self: *Self) { ... }
I'd be intrested knowing what you guys think about this and what you usually do? 🙂