[swift-evolution] [Draft] Allow declaration of abstract functions and properties on classes
wallacyf at gmail.com
Wed Mar 2 08:53:09 CST 2016
Em seg, 29 de fev de 2016 às 17:20, David Scrève <swift-evolution at swift.org>
> 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
> 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 ?
Protocols are not concrete types, at some point you will choose if will use
a *reference type* or a *value type* to implement this protocol, and then,
inherit this "default" properties.
> > 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
> > 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
> > It's going a bit far, inheritance has its own advantages in other
> >> 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
> > _______________________________________________
> > swift-evolution mailing list
> > swift-evolution at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-evolution
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution