Content deleted Content added
Change 2024 to 2025 Tags: Mobile edit Mobile web edit |
→Goals: Fix grammar and other stuff Tags: Mobile edit Mobile web edit |
||
Line 40:
The primary goal of Zig is to be a better solution to the sorts of tasks that are currently solved with C. A primary concern in that respect is readability; Zig attempts to use existing concepts and syntax wherever possible, avoiding the addition of different syntax for similar concepts. Further, it is designed for "robustness, optimality and maintainability", including a variety of features to improve safety, optimization, and testing. The small and simple syntax is an important part of the maintenance, as it is a goal of the language to allow maintainers to debug the code without having to learn the intricacies of a language they might not be familiar with.{{sfn|Elizabeth|2017}} Even with these changes, Zig can compile into and against existing C code; C headers can be included in a Zig project and their functions called, and Zig code can be linked into C projects by including the compiler-built headers.{{sfn|Yegulalp|2016}}
In keeping with the overall design philosophy of making the code simple and easy to read, the Zig system as a whole also encompasses a number of stylistic changes compared to C and other C-like languages. For instance, the [[Rust (programming language)|Rust]] language has [[operator overloading]] which means a statement like {{code|a {{=}} b + c}} might actually be a function call to a type’s overloaded version of the plus operator. Further, that function might panic which might pre-empt any following code. In Zig, if something calls a function, it looks like a function call; if it doesn’t, it doesn’t look like a function call. If it
The goals of Zig are in contrast to those of many other languages designed in the same time period, like [[Go (programming language)|Go]], [[Rust (programming language)|Rust]], [[Carbon (programming language)|Carbon]], and [[Nim (programming language)|Nim]]. Generally, these languages are more complex with added features like [[operator overloading]], functions that masquerade as values (properties), and many other features intended to aid in building large programs. These sorts of features have more in common with C++’s approach, and these languages are more along the lines of that language.{{sfn|Yegulalp|2016}} Zig has a more conservative extension of the type system, supporting compile time generics and accommodating a form of [[duck typing]] with the {{code|comptime}} directive.
|