|
|
Subscribe / Log in / New account

Zig heading toward a self-hosting compiler

Zig heading toward a self-hosting compiler

Posted Oct 7, 2020 17:46 UTC (Wed) by snopp (guest, #138977)
In reply to: Zig heading toward a self-hosting compiler by khim
Parent article: Zig heading toward a self-hosting compiler

>>> And Zig offers something really unique in a modern era: the ability to survive in a world where memory is finite

Do you mind elaborate a bit more about the point above? Or a link to where I can read more about it.


to post comments

Zig heading toward a self-hosting compiler

Posted Oct 7, 2020 18:17 UTC (Wed) by chris.sykes (subscriber, #54374) [Link] (1 responses)

Check out:

https://ziglang.org/#Manual-memory-management

https://ziglang.org/documentation/master/#Memory

The second link is is worth reading in its entirety if you're interested in an overview of the language features.

Zig heading toward a self-hosting compiler

Posted Oct 8, 2020 13:43 UTC (Thu) by kleptog (subscriber, #1183) [Link]

The use of arenas is good method for dealing with out-of-memory issues. Programs like PostgreSQL and Samba use these techniques (in C) to handle out of memory, but they are also needed if you want to do any kind of exception handling. So this is something Zig does well. But then I read things like:

> The API documentation for functions and data structures should take great care to explain the ownership and lifetime semantics of pointers. Ownership determines whose responsibility it is to free the memory referenced by the pointer, and lifetime determines the point at which the memory becomes inaccessible (lest Undefined Behavior occur).

Since we now have Rust as demonstration that all the ownership checks can be done at compile time (thus no runtime cost) this feels like a missed opportunity.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds