[swift-evolution] [Review] SE-0030 Property Behaviors

Evan Maloney emaloney at gilt.com
Tue Feb 23 14:54:35 CST 2016


> I would like to have abstract classes and members in Swift. This is just another place where they turn up and would allow mor consistent declarations.
> Other languages do make good use of them and have protocols (interfaces, traits) as well. As long as classes define types abstract members make sense.

+1.

This really resonated with me since I read it just after using fatalError() to handle something that would be better achieved by being able to declare an abstract func. It's one of the single largest uses of fatalError() in our codebase.

Adding an abstract declaration would make it possible for the compiler to enforce a requirement that today can only be enforced at runtime; as a result, it would make Swift more Swiftyâ„¢.

(Our other largest use of fatalError() is to provide an "implementation" for the required init(coder:) in my UIView[Controller] subclasses. How I wish UIKit weren't so doctrinaire with people who don't use Interface Builder or the state restoration API. But that's an argument for another day.)


More information about the swift-evolution mailing list