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

Wallacy 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>
escreveu:

>
> 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 ?
>
>
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.


> 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
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160302/289f0b86/attachment.html>


More information about the swift-evolution mailing list