Closed rtulip closed 1 year ago
Allows users to create anonymous structures. For example:
fn main() { 1 true cast([u64 bool]) as [x] x println // prints `[1 2]` x::0 println // prints `1` x::1 println // prints `true` }
The empty tuple is the first zero-sized type and can be created like this for now:
fn main() { cast([]) println // prints `[]` }
So you can now make your own zero sized types like so:
struct PhantomData<T> { []: _ impl: fn PhantomData.new<T>() -> [PhantomData<T>] { cast([]) cast(PhantomData<T>) } }
Type inference doesn't work with the example above as of yet.
This is an important step for making sum types. Next we'll be able to define a sum type like this:
enum struct SumType { [] : NoData Str : PlainOldData [u64 u64 u64]: RGB }
Allows users to create anonymous structures. For example:
The empty tuple is the first zero-sized type and can be created like this for now:
So you can now make your own zero sized types like so:
Type inference doesn't work with the example above as of yet.
This is an important step for making sum types. Next we'll be able to define a sum type like this: