logoalt Hacker News

pjmlplast Sunday at 4:33 PM3 repliesview on HN

Having @ and .{ } all over the place is hardly lovely, as is having modules like JavaScript's CJS.


Replies

Akronymuslast Sunday at 4:35 PM

It's especially bad on a qwertz keyboard as well.

show 2 replies
minitechlast Monday at 2:14 AM

There’s nothing wrong with the CommonJS approach except that it’s not designed for static analysis (and whether that was really an issue is debatable). In Zig, it’s compile-time.

show 1 reply
fallow64last Sunday at 6:27 PM

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 { // ... } ```

show 1 reply