[swift-evolution] [Review] SE-0026 Abstract classes and methods

Chris Lattner clattner at apple.com
Wed Mar 9 21:46:48 CST 2016

> On Mar 9, 2016, at 12:35 PM, Evan Maloney via swift-evolution <swift-evolution at swift.org> wrote:
> On Mar 4, 2016, at 5:42 AM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
>> Someone asked in this discussion whether classes are second-class citizens in Swift, and thinking about it some more I kind of think that they are; after a period of adjustment I now use structs for almost everything. I only use classes where a common reference is absolutely necessary, and also for nested types.
> It seems to me that you are using classes and structs in exactly the right way. However, I don't think your judicious use of classes is necessarily an argument that "classes are second-class citizens in Swift".
> Sometimes classes are the right tool for the job. Sometimes structs or enums are.
> What I love about Swift is that it's often much easier to use the right tool for the right job than other languages. However, if classes are relegated to some sort of demoted status, over time, that would no longer be the case.

+1.  Swift loves OOP as well as POP (not to mention FP).  They are both complementary techniques which are great at solving certain kinds of problems.


More information about the swift-evolution mailing list