
Ziglang – robust, optimal, and maintainable programming language - rodmena
https://github.com/ziglang/zig
======
littlestymaar
> Performance and Safety: Choose Two

How does Zig manages its memory ? I couldn't find any info on a garbage
collector, so I assume the memory isn't dynamically-managed.

If it's statically managed, how is it done ? I it using some kind of region-
based checking, like Rust with its borrow-checker ? Or is it 100% in the hands
of the programmer ? (In which case, the «safety» argument is a bit strange).

~~~
dinglejungle
It's 100% manual[1]; that "safety" you're quoting is not referring to memory
safety.

[1] [https://ziglang.org/#Manual-memory-
management](https://ziglang.org/#Manual-memory-management)

~~~
AndyKelley
memory safety is in fact planned, check out the GitHub issue links at the end
of the safety section for more information. I'm excited about those plans - in
my opinion it will make zig a real competitor to Rust in particular. Until
then rust has the upper hand for the memory safety use case.

------
rodmena
Zig has a number of useful constructs such as sum types, compile-time
introspection, improved error handling and no preprocessor!

------
dang
It's great that people are interested in this, but the topic itself has had
significant attention in the past year, which is the criterion we use for
dupes
([https://news.ycombinator.com/newsfaq.html](https://news.ycombinator.com/newsfaq.html)).

[https://news.ycombinator.com/item?id=19811183](https://news.ycombinator.com/item?id=19811183)

[https://news.ycombinator.com/item?id=19610199](https://news.ycombinator.com/item?id=19610199)

[https://hn.algolia.com/?query=Zig%20points%3E30&sort=byDate&...](https://hn.algolia.com/?query=Zig%20points%3E30&sort=byDate&dateRange=all&type=story&storyText=false&prefix&page=0)

------
networkimprov
Interested to hear what folks see as the major markets for Zig...

EDIT: By _markets_ I meant application categories, e.g. OS kernel, firmware,
embedded, etc.

I'd already gathered that its closest competitors are C and Rust.

~~~
kyllo
It's a systems programming language described as a replacement for C, this
blog post shows how to incrementally replace C with Zig in your codebase:
[http://tiehuis.github.io/blog/zig1.html](http://tiehuis.github.io/blog/zig1.html)

The single-page documentation is here:
[https://ziglang.org/documentation/master/](https://ziglang.org/documentation/master/)

It seems like it would be attractive if you want a systems language that's
much more modern than C (and comes with build and testing systems) but you're
not interested in Rust's borrow-checker.

------
matthewbauer
What does Zig offer over something like Rust?

~~~
dinglejungle
[https://github.com/ziglang/zig/wiki/Why-Zig-When-There-is-
Al...](https://github.com/ziglang/zig/wiki/Why-Zig-When-There-is-Already-
CPP%2C-D%2C-and-Rust%3F)

------
voldacar
Zig truly is a better C, glad to see it getting so much attention around these
parts

------
brianpgordon
What do you mean by "optimal?" You mean runtime performance?

~~~
rodmena
It means you can't write bad code in it. When you write something, the code
will compile the best way it can behave.

