6 ms·
I think zig is a little too opinionated.
by usrn 4y ago
I think zig is a little too opinionated.
- vkazanov 4y agoIt is, indeed, opinionated. It's also small and easy. Rust is superopinionated. Big and complex as well.
- usrn 4y agoYeah I'm not a fan of Rust either. It has some great ideas though. Part of me wants to try writing my own language after I finish my current side project.
- jeroenhd 4y agoYou may be interested in Jakt, an experimental language written for SerenityOS. It has some very Rust-like festures for memory safety but no borrow checker or async (at least, not at the moment). Currently, it compiles into C++ as it's written specifically for an entire operating system written in C++ but I can see native compilation becoming an option down the line. It's far from stable but it's worth looking at: https://github.com/SerenityOS/jakt https://github.com/SerenityOS/jakt
- 127 4y agoWriting multi-line strings in Zig is not easy.
- kristoff_it 4y agoI really don't understand why people have issues with Zig's multiline syntax. \\I really don't \\understand why people \\have issues with \\Zig's multiline syntax
- lostmsu 4y agoI never used Zig, but used many other languages, and that looks better than most which don't have line prefix like \\: in languages that don't need it there is confusion about significance of whitespace in the beginning of 2nd+ lines.
- kristoff_it 4y agoYep, that's precisely what that sintax solves, and also makes it easier to build a grammar for it (think of editor syntax highlighting for example) because the multiline marker is repeated in every line, instead of being a contextual marker. This is the same reason why Zig doesn't have dedicated multiline comment syntax.
- 127 4y ago- Can't easily indent - Can't easily copy paste - Can't easily edit - Looks ugly - Harder to read
- vkazanov 4y agoHuh? It might be slightly wordy, but otherwise very simple and easy for both people and computers to read. Even a primitive editor with primitive highlighting can make the syntax painless. Reasoning: https://github.com/ziglang/zig/issues/162 https://github.com/ziglang/zig/issues/162
- oconnor663 4y agoRust definitely has its opinions and its chosen complexities. I'd point to the way global allocators are used by default (opinionated) and the way trait coherence rules work (opinionated and kind of complicated). That said, I think a lot of the complexity of Rust is actually fallout from a relatively small number of design choices: - programs ought to be UB-free by default, and overriding those defaults should be rare - mutation is allowed, including shared mutation across threads - runtime assumptions similar to C and C++, i.e. no garbage collector, and a useful subset of the lanugage doesn't require heap allocation Given those requirements (in short, a "safe systems programming language"), I think you very quickly find yourself needing 1) lifetimes, 2) the no-mutable-aliasing rule, and 3) move semantics. Those things contribute a lot of the "feel" of Rust, and probably the majority of the difficult learning curve. But I think it's interesting to consider that "the type system should deal with lifetimes" isn't really a baked-in opinion that Rust has, as much as it is the necessary complexity stemming from the other opinions above.
- ccbccccbbcccbb 4y agoCompared to the tyrannical Rust, maybe.
- deleted 4y ago[deleted]
- Comevius 4y agoOpinionated in the context of programming languages usually means that the language forces it's own abstractions on you, you have to work with and around them. Zig is not like that, it's pretty much just C, but simpler, ergonomic. It's design is a reasonably simple, portable abstraction of contemporary hardware. It gives you all the power to come up with your own abstractions on top of that.