Conversation

Jarkko Sakkinen

i hope #zig will be sustainable. i like its way more than #rust. and like in C or even RISC-V microarchitecture, but not so much in Rust and C++, the language definition is compact enough so that it just stick into your head. also, comptime is really cool invention in my opinion. #C #rustlang #riscv

https://ziglang.org/
3
3
10

@jarkko I feel like comptime is one of those things that’s convenient at first. But, then you build a function that’s restricted solely by compiler checks and doesn’t have a “proper” interface.

If anyone tries to develop on comptime you either have to document the requirements, let the users figure it out by compiler errors, or wrap it in interface functions. Plus any change can break code down the line.

It seems cool at first but, I like it less the more I look at it.

1
0
0

@jarkko When you say "sustainable" do you mean "the project is enduring" or "sustainable ecologically?"

1
0
0
@codrusofathens i hope project endures, it has some great and original ideas
0
0
0
@zethtren thanks for the remark! there's other things also that i like, e.g. fine grain control to memory policy. it allows to easily at least mitigate from memory allocation failures, which requires effort in Rust. and I like the way FFI works in zig. that said, not real experience with the language but i think it does deserve its existence :-) it would be interesting see how those ideas mature over time...
1
0
1

@jarkko Yeah it definitely has a lot of neat things (Super great for systems level stuff). I personally feel the ergonomics fall apart a bit in the module level scope of things. The FFI (especially with C) is definitely fantastic though.

I don’t have much direct experience with Zig except for friends that share their hype with me. So I can’t speak for it directly. Rust does provide a surprising amount of “experimental” and “nightly” features for memory though too.

1
0
0
@zethtren I don't really know anything about where trends and hype is at either :-) I just see bunch of useful applications with emphasis on modernising legacy C software (thanks to robust FFI) and also anything where executable size is critical it seems to have its edge...
1
0
0

@jarkko in rust you have the const keyword for that (but not all operations can be done in a const function)

0
0
0

@jarkko @zethtren Zig is NOT memory safe. A huge step backwards…

Here is a proof from the most famous project written in Zig - Bun:
https://github.com/oven-sh/bun/issues?q=segfault

Note that segfaults are harmless in comparison with other memory issues.

Here is some use-after-free for another example:
https://github.com/oven-sh/bun/issues/9093#issue-2152496603

I am not for Rust over all other languages. But Zig is a danger if it gets adopted. It goes against all the initiatives towards memory safety (e.g. US government, Google, Microsoft, etc.)

1
0
0

@jarkko @mo8it @zethtren Interesting to know. I personally lean more in favor of Rust in my application development. I totally understand its appeal. Especially from post C devs and devs that are used to doing hacky things with memory. But, this does shed some light on some of the claims Zig makes that I’ve been skeptical of.

0
0
0