[swift-evolution] Epic: Typesafe calculations

Tino Heth 2th at gmx.de
Wed Jan 20 16:49:25 CST 2016


> Yeah, I knew that's what you were doing.  If you extend typealiases
> enough, I suppose, they become like class templates with partial
> specialization, but supporting them throughout the language would
> require fundamental changes to our type system that have nothing
> intrinsically to do with typealiases.

Speaking of the type system:
Has there been any discussion about inheritance for structs?

It isn't hard to guess why it is forbidden (pass-by-value would make sub-structs incompatible with their parents as soon as you add member variables), but imho there are many examples where you are forced to use reference-semantics just because you want inheritance for things that are good candidates for struct (I'm thinking of data objects like Person/Customer/Employee, Color/ColorWithAlpha…)

Tino


More information about the swift-evolution mailing list