[swift-evolution] [Deferred] SE-0026 Abstract classes and methods

Joe Groff jgroff at apple.com
Mon Mar 7 12:32:04 CST 2016


> On Mar 7, 2016, at 10:10 AM, Goffredo Marocchi <panajev at gmail.com> wrote:
> 
> Hello Joe,
> 
> A few quick questions came to mind after reading your answer, if you do not mind. You mention protocols falling short in some areas to provide part of the functionality that abstract classes provide, but is the concern that we may be making protocols harder and harder to pickup and use correctly by giving them so much responsibility?l

There's always a tradeoff between power and complexity. Some discussions have proposed separating "mixins" from protocol extensions as a more clearly delineated feature for composing storage and associated functionality into objects, which would offload some of the responsibility from protocols.

> Also, do you think the lines between structs, protocols, and classes going to blend even more with these and other similar changes? 
> 
> (Although only tangentially related perhaps...) Did the core team stated what they planned to do about pitfalls with dispatching and protocol extensions with default method in extensions being statically dispatched and actual method resolution then being dependent on the type of the reference rather than the instance the reference is pointing at? Is this area being addressed in Swift 3 at all?

It's something we'd like to address, yes. Two options that have been discussed are to provide better diagnostics for the current behavior, or to make extension methods dynamically dispatched themselves.

-Joe



More information about the swift-evolution mailing list