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

Dave Abrahams dabrahams at apple.com
Wed Mar 9 16:22:11 CST 2016


on Wed Mar 09 2016, Evan Maloney <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.

I promote protocols, but I wouldn't want to demote classes.

-- 
-Dave



More information about the swift-evolution mailing list