<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=""><div class="">I believe you’re referring to this&nbsp;<a href="https://gist.github.com/erica/eb32feb22ba99629285a" class="">https://gist.github.com/erica/eb32feb22ba99629285a</a>&nbsp;currently being developed. I was initially limiting this proposal to initializers, specifically overriding them verses immediately following them. This is an important distinction because it would require required properties, verses the initializers still taking care of this. This doesn’t make it in opposition to method cascading, it might possibly be a nice addition. It also appears like self is not maintained (in that method cascading proposal anyhow), self is just not required unless variables names overlap. Below is my exercise in keeping self.</div><div class=""><br class=""></div><div class="">Perhaps this alternative would work:&nbsp;</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">class</span> Foo {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">var</span> name:<span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">String</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">init</span> (name:<span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">String</span>) {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">self</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">name</span> = name</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">class</span> Fee {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">var</span> name:<span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">String</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #e82300" class="">"Fee-fi"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">static</span> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">func</span> createFoo (name:<span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">String</span>) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">Foo</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> foo = <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">Foo</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foo.name = <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">self</span>.name + <span style="font-variant-ligatures: no-common-ligatures; color: #e82300" class="">"-"</span> + name</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">return</span> foo;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> name = <span style="font-variant-ligatures: no-common-ligatures; color: #e82300" class="">"fo-fum"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> other = <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">Fee</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">createFoo</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">name</span>);</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(207, 135, 36);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">other</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">name</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">) </span>// "Fee-fi-fo-fum"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> another = <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">Foo</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(207, 135, 36);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>// name = self.name // Ambiguous, self isn't defined.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(207, 135, 36);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>// self.name = name // Simplist, but isn't clear within scopes that contain self (like class functions) It would require a common javascript work around for this, saving a `that = this;` before the closure.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(207, 135, 36);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; another.name = </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">name</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>// Clear, another is only required when names overlap in scope.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(207, 135, 36);" class="">&nbsp; &nbsp; // print((self == nil)) // true</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">This has restrictions. An initializer can’t be used directly within a return for example:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">class</span> Fee {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">var</span> name:<span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">String</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #e82300" class="">"Fee-fi"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">static</span> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">func</span> createFoo (name:<span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">String</span>) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">Foo</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">Foo</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">return</span>.name = <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">self</span>.name + <span style="font-variant-ligatures: no-common-ligatures; color: #e82300" class="">"-"</span> + name</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">That is admittedly awkward, bad form, but not technically wrong.</div><div class=""><br class=""></div><div class="">Unless there is a better alternative, keeping self the same inside the closure as outside seems difficult to do, but not impossible.</div><div class=""><br class=""></div><div class="">-Weston</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 3, 2016, at 7:39 AM, Tino Heth &lt;<a href="mailto:2th@gmx.de" class="">2th@gmx.de</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Something similar has been discussed ("method cascading"), and I hope the feature will be considered for Swift 4(?).<br class="">It is a little bit different, though:<br class="">"self" would not change its meaning (which imho is a plus), and the syntax is different.<br class=""><br class="">Tino</div></div></blockquote></div><br class=""></body></html>