Type aliases
Opened this issue · 0 comments
Mesabloo commented
Sometimes, writing some code yields very complicated types (we can see some of them in the test codes⁽¹⁾).
Those types are hard to write, hard to read, and you probably never write them only once.
We propose to introduce type aliases, using a special construct such as type TypeName<typeParams...> = <type>
where typeParams...
are type variables annotated with their kinds (as in the forall
construct for label types).
This construct allows to reuse types while giving them a more semantically correct name. It also reduces the cost associated with refactoring when, for example, we change the return type of a function and add another register.
And this has no runtime cost, since all types are erased.