<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Oh god yes.<div class=""><br class=""></div><div class="">On behalf of every descendant of UIViewController and SKScene, I thank you for this idea.</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">class MyViewController: UIViewController {</font></div><div class=""><font face="Menlo" class=""> let someNewThing: </font><span style="font-family: Menlo;" class="">SomeType</span></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> <b class="">leaf</b> init(someNewThing: SomeType) {</font></div><div class=""><font face="Menlo" class=""> // no calls to super, no calls to *anything*</font></div><div class=""><font face="Menlo" class=""> self.someNewThing = someNewThing</font></div><div class=""><font face="Menlo" class=""> // blah blah use self here blah</font></div><div class=""><font face="Menlo" class=""> }</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><b class="">@memberwise</b> class MyScene: SKScene {</font></div><div class=""><font face="Menlo" class=""> let someNewThing: </font><span style="font-family: Menlo;" class="">SomeType</span></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> // boom. done. initless.</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 29, 2016, at 11:53 PM, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Forward: This isn’t a concrete proposal, this an observation (originally from Joe Groff) of a problem that we hoped to have time to discuss and design in the Swift 3 timeframe, but which the core team won’t have time to drive. If anyone is interested in picking up this as a project to scope, design, and drive, that would be great. :-)<br class=""><br class=""><br class="">Class initialization in Swift support a wide array of knobs and concepts, including things like designated initializers, required initializers, convenience initializers, etc. These are all required by various common patterns in Cocoa and other OO systems, but has an unfortunate side effect: all of the complexity is foisted on you at once. This typically happens because you subclass a system framework and start getting errors about not fulfilling the requirements that may not be fully defining the behavior that would be required if another class comes along and derives from you.<br class=""><br class="">The simplifying observation here is that many classes (particularly in gui apps) are leaf classes that are not further derived from. Wouldn’t it be great if you could freely define a new class and not have to know about required and convenience initializers? It seems that we should only have to enforce these requirements if you a) further derive from this class within your module, or b) mark the class publicly-derivable-from.<br class=""><br class="">This isn’t a full pitch because I haven’t done a survey of all of the simplifications we could offer, and getting the diagnostics messages right for this would take a significant amount of work (e.g. explaining why "class X needs a required init because class Y started deriving from it”).<br class=""><br class="">-Chris<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></div></body></html>