[swift-evolution] Abstract methods

C. Keith Ray keithray at mac.com
Thu Nov 2 16:30:46 CDT 2017


If a class partially implemented a protocol, it also would not be instantiatable, but a subclass can supply the missing method(s). Doesn’t the compiler already handle that? How are abstract classes harder?

C. Keith Ray
https://leanpub.com/wepntk <- buy my book?
http://agilesolutionspace.blogspot.com/
twitter: @ckeithray
http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf

> On Nov 2, 2017, at 2:22 PM, Slava Pestov <spestov at apple.com> wrote:
> 
> Abstract methods and classes seem like they will introduce a fair amount of complexity in the type checker, particularly around metatypes and constructors, because now we have this new concept of a class that cannot be directly instantiated. I’m not sure the cost is worth the benefit.
> 
> Slava
> 
>> On Nov 2, 2017, at 12:45 PM, C. Keith Ray via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> How many "subclass must override" assertions or comments in base class methods do we need to see, to want to add "abstract" to the Swift language? 5? 50? 500?
>> 
>> It's a not uncommon idiom in Objective-C.
>> 
>> I'm about to port a substantial amount of C++ code to swift, and compiler help to enforce abstract classes would be very useful.
>> 
>> 
>> --
>> C. Keith Ray
>> Senior Software Engineer / Trainer / Agile Coach
>> * http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf
>> 
>> 
>> 
>> _______________________________________________
>> 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/20171102/74e15fef/attachment.html>


More information about the swift-evolution mailing list