Egor Trutenko
12/21/2018, 11:41 AMtypealias Spacing = Horizontal
Where Spacing
was a data class
with property size: Int
, and Horizontal
is a new data class
with property height: Int
.
Nothing was broken after that little conversion, although it occured to me that if someone had used named arguments, e.g. Spacing(size = 8)
, then it wouldn't have been valid, and I don't like the idea that I would have had to rename my height: Int
back to size: Int
.
So I'm suggesting that typealiasing classes would also support parameter names aliasing. Off-hand syntax proposal:
typealias Type1 = Type2 {
namealias property11 = property21
namealias property12 = property22
...
}
I'm not sure about this feature design though. It might get abused in order to implement polymorphism (might not) which I don't think is a good idea