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

Evan Maloney emaloney at gilt.com
Wed Mar 9 14:35:46 CST 2016


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.



More information about the swift-evolution mailing list