Hacker Newsnew | past | comments | ask | show | jobs | submit | horenso's commentslogin

Try a few different languages to see what fits your style. I'm a fan of both Rust and Zig, but I've been really enjoying Zig lately.

Rust has a cool concept called ownership to prevent memory bugs. This means you have to learn new ideas like lifetimes. For instance, an array doesn't just hold objects; it has a lifetime of its own, so you can only store references that will last at least as long as the array. It's most useful IMHO for programs with many independent lifetimes because it makes writing memory-safe code much easier. It really leans into the concept RAII which comes from C++. You implement types and define what it means to create, copy, "move" and destroy them.

Zig on the other hand feels incredibly lightweight. It's like C, but with way fewer pitfalls and better tools. For instance, tts default DebugAllocator tracks memory leaks at runtime, which is good enough for many situations and makes the language less complex to work with. It is common in Zig to pass Allocators, which makes you think more about pooling allocations and simpler allocation strategies. I think learning low level concepts like memory management, pointers, memory layout, interfacing with the OS etc. is easier is fantastic in Zig.


Thanks! I probably will end up trying both at least a little bit.

Rust's memory management did sound neat when I was reading about it. Rust is also more mature, so probably more useful for now. I really like Go's simplicity though, which makes Zig sound interesting too.

I also just remembered Nim. I didn't get very far with it, but it also seemed cool.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: