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

David Scrève david.screve at dlta-studio.com
Mon Feb 29 11:08:22 CST 2016


Actually, I don’t understand the opposite that is made between Extension (that is ported by POP) and Specialization (ported by inheritance).

Many OOP missed extension concept and developer mis-use inheritance to make extension…but having both concept allow to use properly extension and inheritance.

If you make inheritance not fully operational, Swift will have exactly the same problem : people will try to make specialization with extension (using POP) whereas they should use inheritance.

In addition, I thing adding stored property to protocol create a new question : Why using classes if protocols provide the same feature ?

Regards,

David


> Le 29 févr. 2016 à 17:50, Pierre Monod-Broca via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 
>> 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.
> 
> 
> 
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4233 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160229/0fbf8632/attachment.p7s>


More information about the swift-evolution mailing list