logoalt Hacker News

fallow64last Sunday at 6:27 PM1 replyview on HN

Every file is an implicit struct, so importing a module is just importing a struct with static members.

You can also do something like:

```Point.zig x: i32, y: i32,

const Self = @This(); fn add(self: Self, other: Self) Self { // ... } ```


Replies

pjmlplast Sunday at 6:38 PM

Yeah, which is basically how requires() kind of works.