4 ms·
I'm not arguing that Rust should be a Common Lisp like, Waterfall style cathedral. But for something a little less unwieldy that _could_ be specified without th
by j-pb 5y ago
I'm not arguing that Rust should be a Common Lisp like, Waterfall style cathedral. But for something a little less unwieldy that _could_ be specified without the collaborative effort of a hundred people. (Even more relevant now that Mozilla is no longer paying for those people.)
Rust has a lot of great ideas, but it feels more like a prototype that got out of hand, than a focused safety oriented tool. Combine that with a healthy dose of over-optimistic marketing and wishful thinking and you got yourself a bubble.
Rust is way too much cathedral than bazaar. Does it really have the need for a Macro system yet? Except for C++ template envy, JS has shown that transpilers are a workable alternative. Is the complex module system with access control necessary yet?
Does the Std library need to be this comprehensive?
> but why is Zig in this discussion?
Simply because it's simple, and is perceived to target the same niche as Rust.
I would have used Carp as a stand-in, but that's even more esoteric.
I'd argue that neither Rust nor Zig actually target that niche properly, Rust is too complex to get the implementation and models right, while Zig is too conservative and not having the right model as a goal.
Yet if I had to bet on either, it'd be on Zig simply because:
There are two methods in software design. One is to make the program so simple, there are obviously no errors. The other is to make it so complicated, there are no obvious errors.
-Tony Hoare
- littlestymaar 5y ago(TL;DR; Zig isn't simpler than Rust from an implementation perspective, quite the opposite. And the respective compiler size is a good illustration of that point) > Simply because it's simple But by what metric? For instance, why do you consider comptime being simpler than macros? Macros are a dedicated tool built for one specific job (compile-time pre-processing). Comptime means re-using the same syntax for both compile-time and run-time execution. Yes it is pretty elegant, and I like it but it is more complex that the Rust model because you now have a tool that needs to work with both cases. Same async, Rust has async functions and regular function, Zig has functions that are automagically coerced to the right type by the compiler. Is it ergonomic, probably (but not always), but it's much more complex to implement under the hood. Last but not least: memory safety, Zig's goal is to achieve a reasonable level of memory safety by using a collection of built-in sanitization tools. Those tools are much more complex than the borrow-checker (which rely on 2 simple rules: move semantic and shared XOR mutable)and for the most part they don't even exist! Zig's goal is developer ergonomics, and it's really cool to see radical experimentations in that space (and as I said, what zig has done with regard to cross-compilation is inspirational for every language author on this planet) but it's not simplicity. Otherwise, the Zig compiler probably wouldn't be 120% bigger than the rust one right?! (Rustc has 1.6 million loc[1], Zig has 3.5[2], more than twice as much. [1]: https://tokei.rs/b1/github/rust-lang/rust https://tokei.rs/b1/github/rust-lang/rust [2]: https://tokei.rs/b1/github/ziglang/zig https://tokei.rs/b1/github/ziglang/zig
- AndyKelley 5y agoUm that lines of code figure is nowhere near accurate. I reported recently[1] that the zig compiler is 140,331 lines. [1]: https://mobile.twitter.com/andy_kelley/status/1453910640943271941 https://mobile.twitter.com/andy_kelley/status/14539106409432...
- littlestymaar 5y agoOh, interesting, thanks. Do you have any idea of where all that code comes from? (I'm a big fan of your work btw, I'm just really sad that a few people on this forum seams to like Zig for the sole reason it's not Rust)
- AndyKelley 5y agoyeah I agree, it's one of my least favorite reasons that Zig gets mentioned. All what code exactly? Here's a file-by-file breakdown of the line count: https://clbin.com/iuMTn https://clbin.com/iuMTn