[swift-evolution] Final by default for classes and methods

David Waite david at alkaline-solutions.com
Mon Dec 21 16:50:32 CST 2015

A proposal could allow subclassing final/sealed classes when using @testable import

Sent with my Thumbs

> On Dec 21, 2015, at 10:18 AM, Tomáš Linhart via swift-evolution <swift-evolution at swift.org> wrote:
> Hello,
> I must say, I am not big fun of this proposal because currently in Swift only way how to mock classes is to subclass them. If this proposal becomes reality, it will make mocking of all third-party libraries impossible unless they mark their classes non-final and I am afraid authors will just use the default behaviour so at the end people will stop testing code that is using third-party libraries or they will have to fork the libraries or ask the authors. This can be fixed by having better testing support in Swift but I don't think, this will happen anytime soon.
> I would rather see introduction of better reflection so mock frameworks can be reality. I would like to see also other building block of objected-oriented-programming such as abstract classes, protocols with generic type parameters and not just abstract types (associated types) that allows to design better APIs that don't depend so much on overriding regular classes.
> Tomáš
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151221/cfad6e2a/attachment.html>

More information about the swift-evolution mailing list