I’m referring you to Ross O’Brien’s post: As of Swift 2.2, if a variable has a closure type of e.g. () -> Shape, a closure of type () -> Circle would be considered a match. If a class implements 'func make() -> Shape', a subclass implementing 'func make() -> Circle' has to override. However, if a protocol requires a 'func make() -> Shape', a type implementing 'func make() -> Circle' isn't considered to be conforming. That does seem strange.
Protocols behaves differently than closures and classes and I think they should behave the same. > On Apr 18, 2016, at 1:00 PM, Gwendal Roué <[email protected]> wrote: > > >> Le 18 avr. 2016 à 11:53, Yogev Sitton <[email protected]> a écrit : >> >> Hi Gwendal, >> >> I’m actually trying to start a discussion that will change the current >> behavior of the language. >> That’s why I posted this on the swift-evolution mailing list and not >> swift-users. > > OK Yogev. But what is the problem actually? If some of your code does not do > what you want, is it because of the language, or is it because you still have > to learn something about the language? > > Associated types are not a "hack", they are a feature. Maybe you are not > using it properly, you see? > > If you would tell how those MyShapeProtocol objects are used, it may get > clearer. > > Gwendal >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
