Zig NEWS

Discussion on: Test, test, are we live?

Collapse
freakynit profile image
Nitin Bansal

I have a genuine question regarding Zig:
How is zig able to keep syntax so so friendly while still managing to be a systems language that's as fast as C? I especially mean to compare it to rust which does the same thing, but suffers from vastly complex language syntax...
Thanks..

Collapse
kristoff profile image
Loris Cro Author

It's a matter of philosophy: in Zig the programmer is expected to be explicit and type more code to implement complex interactions. This is sometimes a blessing and sometimes a curse. In Rust you can trivially declare that a type fits a given interface by declaring that it implements a Trait, in Zig you have to do structural equality. On the flipside Rust keeps getting features that add magic to the language which make it harder for devs to have full knowledge of the language.

In my opinion C also meant to have a philosophy similar to Zig's, but it also features an endless chain of footguns and funky syntax that detract from its goal of simplicity.

Collapse
freakynit profile image
Nitin Bansal

Thanks @kristoff

I personally favor simplicity and visibility. Explicit is better than implicit. A language should be minimal, yet, complete. Rest everything should go into standard library, if needed.

Rust "almost" became a perfect language across all domains. But, the complexity of the language itself takes that perfectness away. We need a language like Rust, but without it's complexity. I believe Zig does fit really well here :)