[swift-evolution] [Draft] Allow declaration of abstract functions and properties on classes

Pierre Monod-Broca pierre at monod-broca.fr
Mon Feb 29 10:50:28 CST 2016


> Le 26 févr. 2016 à 16:46, Evan Maloney <emaloney at gilt.com> a écrit :
> 
>> Well not exactly, if you want the same behaviors in subclasses of UIViewController and UITableViewController :
>> - with protocols + extensions, you write in once and apply it to each of your subclasses
>> - with abstract classes you have to write 2 abstract classes, one for direct UIViewController subclasses, one for UITableViewController subclasses
> 
> That's a problem with class hierarchies in general, not with abstract classes.

Yes, but that's not my point, I'm just answering "what's the difference"

> 
> You can use the same argument to call for the removal of classes from Swift,

It's going a bit far, inheritance has its own advantages in other situations.

> which is why I think the fundamental question is, are classes intended to be first-class citizens in Swift?

Good question. I would think so, but only as much as structs, enum and protocols.







More information about the swift-evolution mailing list