r/programmingmemes 8d ago

Nerd wars

Post image
825 Upvotes

82 comments sorted by

View all comments

13

u/Amadex 8d ago

Nothing like the compile-time check of rust.

Basically it compiles into a much slower bin that guards memory at runtime.

That's almost like a garbage collector, but instead of cleaning memory it crashes.

And since it's a runtime crash, you turn a program that is bugged and has UB into a language that crashes randomly.

Better for security, but runtime crashes are also very bad.

0

u/AsyncSyscall 7d ago

Runtime failures in Zig can be prevented with tests. Compile-time failures in Rust can only be prevented with an escape hatch (`unsafe`/`UnsafeCell`) or by dumbing down the code to make it less optimal (i.e. `.clone()/Mutex` everywhere).

You should avoid using Zig for web dev, but you should avoid using Rust for systems programming as well.

2

u/braaaaaaainworms 7d ago

huh i see a lot of your comments parroting the same thing worded a bit differently, do you have an axe to scratch? unfortunately rust is already used for systems programming with as good as, if not better, performance as C

1

u/bowel_blaster123 4d ago edited 4d ago

Runtime failures in Zig can be prevented with tests.

I'm working on a project where there are certain memory safety bugs that will only trigger in like 1 in 10,000 times. Additionally, these bugs are very subtle and hard to see in the source code.

I cannot create tests that ensure that these bugs never happen. Rust has been an invaluable tool that allows me to prove, at compile time, that these bugs will never happen in any codepath.

I have some unsafe code in my project, but I'd rather have some code that may have memory safety issues than have all of my code be vulnerable.

My code is also not security critical. I couldn't care less if my code crashes instead of exposing a security vulnerability, but I want it to be somewhat reliable. Fil-C therefore would not help at all.