Skip to content

Instantly share code, notes, and snippets.

View benmuth's full-sized avatar

Ben Muthalaly benmuth

View GitHub Profile
@lobre
lobre / zig_type_system.md
Last active May 11, 2024 07:40
Zig type system illustrated using ascii diagrams

Zig Type System

Zig aims to be a simple language. It is not easy to define what simple exactly means, but zig is also a low-level programming language that aims for c-compatibility. To reach this goal, it needs good semantics in its type system so that developers have a complete toolbox to manipulate data.

So types in zig are composable, but this can become rapidly overwhelming. See those examples. Are you able to understand them at a glance, as soon as you read them?

*const ?u8
?*const u8
*const [2]u8