Live data from Hacker News

Zig 0.11

ziglang.org

191–193 of 193 posts

Re: Zig 0.11

#191
post #181

Earlier quoted context omitted.

Example clanky bit: memory ownership rules. There are lots of systems where memory changes hands. Game programming, for example. You allocate a big chunk of memory, you put some stuff in it, you hand it off to the graphics card, and some amount of time later the graphics card hands it back to you. Rust gets VERY cranky about this. You wind up writing a lot of unsafe code that is very difficult to make jibe with the e…

I see, so by "embedded systems" you meant a video game console ?

Yes, although I could have just as easily said "low-level systems programming" as embedded. I try to keep in mind that when people say "embedded" they may mean anything from ARM Cortex M series to Raspberry Pi 4s.

Rust is really good when it is control of everything. I love Rust for communication stacks (USB, CANBUS, etc.). Bytes in/state in to bytes out/state out is right in its wheelhouse. Apparently Google agrees--their new Bluetooth stack (Gabeldorsche) is written in Rust. When Rust has this kind of clearly delineated interface, it's really wonderful.

However, Rust does not play well with others as my examples point out. To be fair, neither do many other languages (Hell, C++ doesn't play well with itself). However, that's going to be a disadvantage going forward as the future is polyglot.

Re: Zig 0.11

#192

Earlier quoted context omitted.

Sure one can write memory-bug-free code in x86 assembly too. But how can you prove it? ATS is an example of a low-level systems language where you can prove it.

As Zig promises "not hidden allocation", I assume you can build your allocator in Rust and then use it for all memory allocation in Zig.

A function that doesn't allocate doesn't mean it's safe. (Indeed if anything the opposite is more likely - copying is safe, if slow, writing to something that was passed in tends to be what breaks).

Re: Zig 0.11

#193
post #188

Earlier quoted context omitted.

You should always know who owns some data, even if you aren't using Rust!

Garbage collection means the VM owns it! And that’s great. How it should be.

Welcome to a land of memory bloat because you've got a chain to a reference due to a lack of clear ownership.
Post reply on HN