alias declaration inside a
lib declares a C
lib X alias MyInt = Int32 end
MyInt are interchangeable:
lib X alias MyInt = Int32 fun some_fun(value : MyInt) end X.some_fun 1 # OK
alias is most useful to avoid writing long types over and over, but also to declare a type based on compile-time flags:
lib C ifdef x86_64 alias SizeT = Int64 else alias SizeT = Int32 end fun memcmp(p1 : Void*, p2 : Void*, size : C::SizeT) : Int32 end
Refer to the type grammar for the notation used in alias types.