[swift-evolution] Initializers

David Sweeris davesweeris at mac.com
Mon Jan 30 14:59:14 CST 2017


> On Jan 30, 2017, at 12:36 PM, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This seems to contradict Swift’s goal of being safe by default <https://swift.org/about/>, no?

IIUC, it wouldn’t contradict that goal if the compiler could guarantee that everything still gets initialized. I don’t know how that would work with classes that have private/fileprivate properties, though. If you’re subclassing something from the same project, the compiler could just look, but seeing as how exposing those things would kinda defeat the purpose, I don’t think there’s an existing mechanism for it to check 3rd party classes. Maybe we could add a flag to classes’ binary format indicating whether it’s possible for the compiler to infer if super.init() can be safely skipped?

I don’t have a opinion yet on whether this proposal is a good idea… I’m just commenting on (my understanding of) Swift’s safety goals.

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170130/4fa1ceaa/attachment.html>


More information about the swift-evolution mailing list