> Precisely. To me unions are to enums with associated type the same way tuples 
> are to structs.
Me too — and I think it would be beautiful if it could be modeled that way, so 
that there is always a pair of a named and an anonymous variant for functions 
(closures), types (structs) and enums (yet to come). 

> One is named, has well-defined semantics, can conform to protocols, can have 
> complex internal structure, can have methods, etc. The other is ad-hoc and 
> lightweight, easy to define at the site of use, best suited for simple 
> purposes, has special syntax to support it. 
That also true for closures, yet I'm very happy how flexible regular methods 
can be used as blocks.

> Even if we can extend tuples in the future, though, I wouldn't want structs 
> to go away. When exceeding some level of complexity structs are just more 
> explicit than tuples, and therefore easier to understand.
I don't think something as fundamental as structs should ever be removed, but 
imho it would be great to see some unification of concepts…

struct Point: Tuple<x: Float, y: Float> {
        // methods...
        // "inheritance for structs"-poposal delayed until Swift 4 ;-)
}
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to