fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

11K
active users

I'm somewhat disappointed by all of the "modern #C" like #programming languages out there. #Zig and #Rust both feel overly complicated to me and I never feel like I really understand the language. I've really, really liked #Harelang, but the lack of supported platforms kinda scares me away.

Am I missing something or am I just too picky? I want a language I can enjoy writing without living in fear of the typical C shenanigans.

Mo Bitar :ferris:

@lintmoth Is Rust more complicated than C and Zig? Yes, learning it takes longer. But in the long term, Rust is easier when it comes to managing or contributing to some big project. It gives you confidence.

On the other hand, C and Zig seem to be "easy" since you don't need to learn a lot to get started. But they are both NOT memory safe.

Take a look at this most known big Zig project:
github.com/oven-sh/bun/issues?

Note that a SEGFAULT is rather harmless compared to other memory bugs.

GitHubIssues · oven-sh/bunIncredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one - Issues · oven-sh/bun

@lintmoth The highest priority of Bun since 2022 is to improve stability:
github.com/oven-sh/bun/issues/

"Improve stability. Bun should not segfault (all segmentation faults are bugs in bun). bun install should work as reliably as npm. We need more testing for error cases throughout Bun's test suite. We need to be running Address Sanitizer regularly and possibly Valgrind as well. We need to do fuzz testing."

Related bugs are still open since 2022 and new ones are regularly opened…

GitHubBun's priorities · Issue #798 · oven-sh/bunBy Jarred-Sumner

@Fingel @lintmoth True, but this is the first time I read about the (failing) priority from 2022.

I am not pretending that Rust programs don't crash. I am talking about memory safety. Zig isn't memory safe. A crash with a SEGFAULT is probably the "best" outcome of a memory bug.

A panic in Rust is about the program interrupting itself because of some unhandled/violated logic. Not interrupted by the kernel because of a memory violation.

@mo8it @Fingel @lintmoth Fyi, buffer overflows and double frees etc. are in Zig only possible when reallt jinxing it like modifying the .len field of a slice. This is, however, the equivalent to just writing unsafe and its very obvious to the programmer.

Double frees are detected and instantly crash the program I think.

You might just wanna give zig an actual shot, you might enjoy not having a compiler precenting you from doing perfectly legal things.

@Markus @mo8it @lintmoth username checks out! But yea I agree. I really like Zig as well.

I’m currently doing Phill Opp’s “write an OS in Rust.” Excellent series but it’s so full of unsafe blocks it’s not even funny. I’m going to try to replicate it in Zig afterward and see how it compares!

@Markus @mo8it @Fingel @lintmoth Don't bother with a Rust a cultist. Anything not Rust is bad for them.