In reply to:

Why would you want to add all of these different formats where only one
could serve them all. This is redundant in my opinion.

`struct<>` and `enum<>` would have same rules, only the first element would
be a different value-type. I might consider this as an alternative.

Correct me if I’m wrong with the redundancy.


'enum<>' might be valid, unless their functions (e.g. for 'init(rawValue:
Int)' or 'allCases') are declared in explicit protocols which would
implicitly cover enums and which other types could declare conformance to.

'struct<>' does seem redundant unless it becomes subtypeable. If you want a
struct which conforms to several protocols, protocol<> already covers this.
I know there's a discussion at the moment regarding the equivalent of an
'AnyObject' for value types, which might apply to this discussion, but I'm
not sure how.

A class in general would also a protocol<AnyObject, ...>. The benefit of
'type<>' is in its ability to extend the behaviours of several subclasses
at once, e.g. type<UIViewController, UIScrollViewDelegate> covers all view
controllers with scroll views, not just UITableViewController,
UICollectionViewController, etc..



​
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to