<div dir="ltr">On 23 June 2017 at 00:36, Brian King <span dir="ltr">&lt;<a href="mailto:brianaking@gmail.com" target="_blank">brianaking at gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>A similar syntax has already been proposed and has been `deferred`. There are a few other links to discussion in the proposal.</div><div><br></div><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0018-flexible-memberwise-initialization.md" target="_blank">https://github.com/apple/<wbr>swift-evolution/blob/master/<wbr>proposals/0018-flexible-<wbr>memberwise-initialization.md</a></div></blockquote><div><br></div><div>thank you Brian.</div><div><br></div><div>i like the &quot;default value&quot; idea in those proposals. speaking of lazy vars, maybe just to not have them in the default memberwise initializer param list at all:</div><div><br></div><div>// this is NOT how the language behaves currently:</div><div><br></div><div><div>struct S {</div><div>    var a: Int</div><div>    var b: Int = 0</div><div>    var c: Int?</div><div>    var d: Int? = nil // same as c</div><div>    var e: Int!</div><div>    lazy var f: Int = { return 0 } ()<br></div><div>    </div><div>//  expected &quot;reasonable&quot; default memberwise initializer autogenerated or opt-in-ed:</div><div>//</div><div>//  init(</div><div>//      a: Int,</div><div>//      b: Int = 0,     // got default value #change</div><div>//      c: Int? = nil,  // got implicit default value #change</div><div>//      d: Int? = nil,  // got default value #change</div><div>//      e: Int!         // no default value - safer</div><div>//                      // f is absent due to lazy #change<br></div><div>//  )</div><div>//  {</div><div>//      self.a = a</div><div>//      self.b = b</div><div>//      self.c = c</div><div>//      self.d = d</div><div>//      self.e = e</div><div>//                      // f is absent due to lazy #change<br></div><div>//  }</div><div>}</div></div><div><br></div><div>speaking of private var members, if they have an implicit or explicit default value:</div><div><br></div><div>private var g: Int = ...</div><div>private var h: Int?</div><div>private var i: Int? = ...</div><div>private var j: Int!</div><div>private var k: Int! = ...</div><div><br></div><div>they can be omitted from the parameter list of the default memberwise initialiser (#change) similar to how lazy vars are omitted above.</div><div>if a single private var has no implicit / explicit default value then default member wise initialiser is not created (#change) and attempt to opt-in to have one gives an error. let&#39;s call it proposal #5. this particular one is not a backward compatible change, the old code will have to be modified.</div><div><br></div><div>Mike</div><div> </div></div></div></div>