Struct / Union types


User Type names must always start with a capital letter (A-Z) and be less than 32 characters in length. Valid non-start characters are: [A-Z a-z 0-9 _]


<public> type [Name] struct/union <attributes> {

Members / Sub-structs

Member syntax for sub-structs is:

struct/union <name> {

Member syntax for non-substructs is:

[type specification] [name] ;


  • member types may not be const
  • member names adhere to VarDecl naming rules
  • substructs may be anonymous (no name)
  • if substructs are named, the name has the same rules as other members
  • member names must be unique, but multiple sub-structs have the same name if at least one of the sub-structs itself is named.


Structs/Unions can have the following attributes:

  • export
  • packed (structs only)
  • unused
  • aligned
  • opaque


public type Point struct @(packed, aligned=8) {
    i32 x;
    i32 y;

type Outer struct {
    struct inner {
        i32 x;
    Other o;
    union {
        void* p;
        u32* u;
        bool* b;