ark-lang / ark

A compiled systems programming language written in Go using the LLVM framework
https://ark-lang.github.io/
MIT License
682 stars 47 forks source link

Specifically sized enums. #715

Open kiljacken opened 8 years ago

kiljacken commented 8 years ago

It occured to me that it would be useful to be able to specify hte size of a enum. We'd of course need a new syntax for this. I propose the following:

type Thing enum : u8 {
    A = 50,
    B,
    C,
}

In the case of simple enums it would simply be the size of the type, in case of a union enum it would be the size of the tag.

To go with this we'd probably need a semantic check for overflow of enum members.