This is the first beta release of Zig.
Zig is a new programming language that is designed to replace C.
Zig can be used to integrate closely with existing C code, or independently, without libc.
Introduction to the Zig Programming Language
Zig has numerous cases of assertions built into the language itself, such as asserting that arithmetic overflow will not happen for most operations. When an assertion fails with safety checks enabled, the program crashes; this helps catch bugs. When an assertion fails with safety checks disabled, undefined behavior ensues; this helps optimization.
In LLVM, bitshifting too far is undefined behavior. Zig requires that you bitshift by a number whose type is the exactly correct size. For shifting a 32-bit integer, you must shift by a 5-bit integer.
Out-of-memory situations are commonly treated with crashes in most development communities. In Zig, this corner case needs to be supported. All standard library APIs return errors for out-of-memory situations, and when you call a function that can return an error, you must explicitly handle or ignore the error in some way. User applications are encouraged to handle memory errors gracefully through syntactic sugar such as %return
.
Zig encourages code writers to be verbose and explicit for the sake of making the code easier to read by humans. Zig language features are designed to avoid hidden control flow. All cases where control flow jumps out of a function body are clearly visible in the source code, such as a function call. Zig does not support RAII or operator overloading because both make it very difficult to tell where function calls happen just by looking at a function body.
Zig tends to avoid syntactic sugar except where it would have a significant effect on the semantics of a program. Zig does not have a C-style for loop, because you can just use the more general-purpose while loop instead with only a little bit of extra code. By contrast, Zig does support the `defer` statement, because it has a significant effect on the semantics.
This release supports the following architectures in freestanding mode:
The standard library contains Operating System abstractions for:
Flesh out the standard library for Windows, streamline Zig installation and distribution for Windows. Work with LLVM and LLD teams to improve PDB/CodeView/MSVC debugging. Implement stack traces for Windows in the MinGW environment and the MSVC environment.
Flesh out the standard library for MacOS. Improve the MACH-O linker. Implement stack traces for MacOS. Streamline the process of using Zig to build for iOS.
Flesh out the standard library for Android. Streamline the process of using Zig to build for Android and for depending on Zig code on Android.
Figure out what are the use cases for compiling Zig to WebAssembly. Create demo projects with it and streamline experience for users trying to output WebAssembly. Work on the documentation generator outputting useful searchable html documentation. Create Zig modules for common web tasks such as WebSockets and gzip.
Flesh out the standard library for uncommon CPU architectures and OS targets. Drive issue discussion for cross compiling and using Zig in constrained or unusual environments.
Create cross platform Zig modules to compete with SDL and GLFW. Create an OpenGL library that does not depend on libc. Drive the usability of Zig for video games. Create a general purpose allocator that does not depend on libc. Create demo games using Zig.
Special thanks to the sponsors.
This beta release contains known bugs and incomplete documentation.