> On Mar 1, 2017, at 5:27 PM, David Sweeris <[email protected]> wrote: > > >> On Feb 28, 2017, at 09:01, Joe Groff <[email protected]> wrote: >> >> >>> On Feb 27, 2017, at 10:21 PM, David Sweeris via swift-evolution >>> <[email protected]> wrote: >>> >>> + all the 1s, along with something like "where !(T: Foo)" >> >> This is an impossible constraint to enforce, since anyone can extend any >> type to conform to Foo. > > Only for protocols, right? I mean, as far as I know, you can’t declare a > superclass in an extension. > > I've been thinking about this for, well, about a day and a half, and I don't > understand why it’s a problem. Wouldn’t any concrete type’s conformance > propagate through the type system? How else would generic functions deal with > types being extended outside the generic function’s module?
Protocol conformances are not intrinsic to the type in Swift. They're effectively independent parameters to generic contexts that require them. The caller from outside the generic function's model is responsible for choosing a conformance to pass. There's no way to statically enforce that no such conformance exists, and there's usually a better way to model things. -Joe _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
