<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>In thinking about this further I think I can summarize my position pretty concisely. &nbsp;</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">A criteria that has been used quite a bit in the feature removal threads and proposals is "if this feature was not already in the language would we add it". &nbsp;I am using a variation of this criteria and asking "if Swift had a feature facilitating more flexible initialization and we could use that feature with Cocoa would we still want to add setup closures?". &nbsp;I don't think we would.<br><br>Sent from my iPad</div><div><br>On Dec 6, 2015, at 8:04 PM, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span style="background-color: rgba(255, 255, 255, 0);">I do agree that current approaches are a bit ugly, that they are common in Cocoa code, and that the proposal cleans this up. &nbsp;I would even enjoy the cleaner syntax in my own code if the feature was adopted.</span></div><div><br></div><div>However, I share Jacob's thought that focusing on improving initialization flexibility is where we should focus. &nbsp;I think it is a better use of our time, effort and language feature "budget". &nbsp;This might be a more complex problem to solve, but the payoff is much larger in the end.</div><div><br></div><div>Ideally instances should be fully configured for their intended use when initialization completes. &nbsp;I view the *need* for post-initialization setup as a deficiency in the language, the interface of the type, or both (even if a type must expose members that are mutated by users during the lifetime of an instance it should still be possible to fully configure an instance for its initial use during initialization). &nbsp;</div><div><br></div><div>If we can remove the aforementioned deficiency we will not need "setup closures". Doing this will require a language feature as well as a way to take advantage of the new feature when using Cocoa (probably through the Objective-C API import mechanism).</div><div><br></div><div>We obviously need to begin with the language feature so that is where I'm focusing right now. &nbsp;I plan to write a first draft of a proposal soon.</div><div><br></div><div>All of this aside, I am still interest in hearing about additional use cases for the "method cascade" idea. &nbsp;If it is more broadly applicable I might find it more worthwhile.<br><br><div>Sent from my iPhone</div></div><div><br>On Dec 6, 2015, at 3:13 PM, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">It seems like setting properties just after init is the main use case here.<div><br></div><div>I'm not against this idea, but I want to point out that this doesn't *need* to be solved by a change to the language. You can easily define a <font face="monospace, monospace">convenience init</font> for UILabel that takes textAlignment, font, text, and numberOfLines as parameters. They could have default values so you can specify just the ones you need.</div><div><br></div><div>I like the idea of being able to do configure objects/values conveniently, but I'm not sure how to justify a language change for it. Perhaps we just need better autogeneration of initializers during Obj-C header import.</div><div><div><br></div></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
<br><div class="gmail_quote">On Sun, Dec 6, 2015 at 1:06 PM, Erica Sadun via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Do you want me to tweak that? Or remove it entirely? Also, I think I forgot to name-drop you slightly earlier as well<div><div class="h5"><div><br><div><blockquote type="cite"><div>On Dec 6, 2015, at 2:04 PM, David Waite &lt;<a href="mailto:david@alkaline-solutions.com" target="_blank">david@alkaline-solutions.com</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word">I’m leaning away from “self in” style syntax - I think there are too many cases where you still want to be able to bind and access the self of the object your closure was declared within.<div><br></div><div>I’m not sure you have to establish a new “self” however - have the type of object given to with is known, so the methods/functions available to it can be exposed as lexical scope.&nbsp;</div><div><br></div><div>To keep code clarity, use of methods/functions which shadow something in higher lexical scope should likely result in compiler errors.</div><div><br></div><div>-DW</div><div><br><div><div><blockquote type="cite"><div>On Dec 6, 2015, at 1:48 PM, ilya via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;white-space:pre-wrap">I applaud honest description of drawbacks in the proposal :) <br><br>There examples given, I think, demonstrate that using self without any special access leads to unresolvable ambiguities. <br><br>If one wants to work "inside" the configured object, this seems like a good job for a private initializer. All of the ambiguities will be resolved, because extracting the init away removes its ability to capture names from the local context. <br><br>Alternatively, I think it makes sense to continue working on configuration syntax, with "default" access to local context and "explicit" access to the object. Let's just replace $0 with something else. <br><br>Hopefully I don't sounds too pessimistic. Erica's proposal looks going in the right direction to me. <br></div><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div dir="ltr">On Sun, Dec 6, 2015 at 23:30 Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>It's probably better at this point for me to collect my thoughts and summarize where I am at.</div><div><br></div><div><a href="https://gist.github.com/erica/eb32feb22ba99629285a" target="_blank">https://gist.github.com/erica/eb32feb22ba99629285a</a></div><div><br></div><div>Please feel free to comment on-list about this proposal (github does not forward comment alerts) and</div><div>then I will start a new list thread as a Proposal rather than as a Request for Discussion.</div><div><br></div><div>Best,</div><div><br></div><div>-- E</div></div><div style="word-wrap:break-word"><div><br></div><br><div><blockquote type="cite"><div>On Dec 6, 2015, at 12:45 PM, ilya &lt;<a href="mailto:ilya.nikokoshev@gmail.com" target="_blank">ilya.nikokoshev@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr">Sorry, did I misunderstand the question?&nbsp;<div><br></div><div>Did you asked whether my definition will work for immutable value types?&nbsp;</div><div>If that's the question, the answer is still yes, the link has an example :)&nbsp;</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 6, 2015 at 10:43 PM, Erica Sadun<span>&nbsp;</span><span dir="ltr">&lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt;</span><span>&nbsp;</span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I was specifically referring to value types. I apologize for not being clearer.</div><span><font color="#888888"><div><br></div><div>-- E</div></font></span><div><div><div><br></div><br><div><blockquote type="cite"><div>On Dec 6, 2015, at 12:42 PM, ilya &lt;<a href="mailto:ilya.nikokoshev@gmail.com" target="_blank">ilya.nikokoshev@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr">Yes, it works for immutable objects with the correct definition, see the playground contents at<span>&nbsp;</span><a href="https://github.com/ilyannn/iOS-Swift-Materials/blob/master/Playgrounds/Configure.playground/Contents.swift" target="_blank">https://github.com/ilyannn/iOS-Swift-Materials/blob/master/Playgrounds/Configure.playground/Contents.swift</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 6, 2015 at 8:10 PM, Erica Sadun<span>&nbsp;</span><span dir="ltr">&lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt;</span><span>&nbsp;</span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I have developed something similar as well (<a href="http://ericasadun.com/2015/11/15/speeding-up-swift-playgrounds-with-closure-initialization-swiftlang/" target="_blank">http://ericasadun.com/2015/11/15/speeding-up-swift-playgrounds-with-closure-initialization-swiftlang/</a>).</div><div><br></div><div>Is yours capable of handling enums and structs that would otherwise be let after declaration because mine is not.</div><span><font color="#888888"><div><br></div><div>-- E</div><div><br></div><br></font></span><div><blockquote type="cite"><div><div><div>On Dec 5, 2015, at 5:16 PM, ilya via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div><div dir="ltr">&gt; PROBLEM: With many Apple-supplied classes, typical initializers fail to fully set up an instance for use.&nbsp; Here's one example: ...<div><br></div><div>FWIW, I created a configuration operator more then a year ago, and use it in all of my Swift projects:</div><div><br></div><div><div>let task = NSTask() +=+ {</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.launchPath = "/usr/bin/mdfind"</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.arguments = ["kMDItemDisplayName == *.playground"]</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.standardOutput = pipe</div><div>}</div><div><br></div><div>Note you can also use the configured object in the rhs:</div><div><br></div><div><div>let questionLabel = UILabel() +=+ {</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.textAlignment = .Center</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.font = &nbsp;UIFont(name:"DnealianManuscript", size: 72)</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.text = currentQuestion.questionText</div><div>&nbsp; &nbsp;<span>&nbsp;</span>$0.numberOfLines = 0</div></div><div>&nbsp; &nbsp;<span>&nbsp;</span>view.addSubview($0)</div><div>}</div><div><br></div></div><div>This $0. certainly looks ugly and it would be great to be able to simplify this. I don't llike the following much though (dot-syntax can be ambiguos here, and using simply a method name is even worse):</div><div><br></div><div><div>let questionLabel = UILabel() +=+ {</div><div>&nbsp; &nbsp;<span>&nbsp;</span>.textAlignment = .Center</div><div>&nbsp; &nbsp;<span>&nbsp;</span>.font = &nbsp;UIFont(name:"DnealianManuscript", size: 72)</div><div>&nbsp; &nbsp;<span>&nbsp;</span>.text = currentQuestion.questionText</div><div>&nbsp; &nbsp;<span>&nbsp;</span>.numberOfLines = 0</div><div>&nbsp; &nbsp;<span>&nbsp;</span>view.addSubview($0)</div><div>}</div></div><div><br></div><div>Actually I would be happy with something like</div><div><br></div><div><div>let questionLabel = UILabel() .{</div><div>&nbsp; &nbsp;<span>&nbsp;</span>..textAlignment = .Center</div><div>&nbsp; &nbsp;<span>&nbsp;</span>..font = UIFont(name:"DnealianManuscript", size: 72)</div><div>&nbsp; &nbsp;<span>&nbsp;</span>..text = currentQuestion.questionText</div><div>&nbsp; &nbsp;<span>&nbsp;</span>..numberOfLines = 0</div><div>&nbsp; &nbsp;<span>&nbsp;</span>view.addSubview($0)</div><div>}</div></div><div><br></div><div>Other thoughts?</div><div><br></div><div>&nbsp;&nbsp;</div></div></div></div><span><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=r5jpKsi6nat7oa43lpCLi5GRGm2utDkbDscuFklXZ2cxud9iRxsZ36zHq7XlPj9-2BOixzAQAUIKv817EfMPap26bUo4Vp7fmXyVAk3kGoXDFbxviOOjJN4IhLbXEbLBgeaEWnLntESKUKKtxs15npR33Hf0fzcj0YKh4IB-2BoUKA5SrRpArMzvl2386L5kt-2Bch5TR24-2FB9K3KdjUboRdcES55hY7En6zqMtl7SJ055yJM-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span>&nbsp;</span>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br></div></blockquote></div><br></div></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></blockquote></div><br><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=1p9Jer2O6jVE9KWvo-2B9iUaEyN8slp4IizyiLwsfp54OfRrvQaqd2xia8dG1-2BVn5WvM90J86tG6uUixundnyEMfUtDUgGlwaoXJ3b4SU4pyN-2FYJjmL-2FT-2Fm-2FUmCeb7arT-2FR4XQQxQEDhEwRxoWqKm69s7-2Byob8G79LYwjtqS6jpJDkVaVEMlrwU1wge1pKq9o4iE3Qef7C-2FLE4kqEFVlmN1zIgU-2FAfQxUqPRdHufxHmH0-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=nE9rxSXA5G4kxsTVkgv43vFcOQoCM-2FU-2BigXPSqPoICKZiPHTExqP3k3nt-2B3uLJqisLQJvNovjHZ0AwJ35OLdvX-2Bkv-2BY88Nwx-2BjvaJmMYDEw6artbn-2F8umz-2FBCTOZgsro8F-2Fne6ICTBsp-2FcUHAws5AXZViXfIQSJLUFAEZoj71BItILAr3dVXTmfcwsLD-2Fh967lOYIIcLn4pbiG-2FvXEg-2F-2BMdB8qwpG0Jwfcgo4aXhOLo-3D" alt="" width="1" height="1" border="0" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span>&nbsp;</span>_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qz8oXUypfOB-2FRrULe8CypmZgLwiPJm71qi4IQos-2FMCZVUsAMqAcm6LTK6wgUTq7B9xPtPc9evxiOlshzRTo7q19Z2LRtaVL5gTAT4bvu-2FffsG-2FS410U-2BWTidjuY3tjy6ZLGIv6YnFENwj-2BcGdNqVHyHubwixKU-2B4rLCzSotMePqXq8hX-2Bn6LJ2I-2Fuzdb8g4KDQ-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div></div></div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAd0xNI-2BT0rtfArTF3Z-2FoMLn-2FrwaLQd1G7ph2SyENufkvqLP-2F26GyiI8ScijUExbZHTkSgkXQ5rUPX8VkUHfF5R9mHUCEdXoiZHS2u0-2B4ikr95pv6C49z6Eeocod4qDdLxrGlSXiF5o35eNobM-2BNlBb4pN341TYhXmqM0Fw44JiNBGA1xXuznekbdA2ZXZqy1ms-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;">
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAf-2BvvarQ72qP1Cu8t1-2BTW61qNlDG7r5Murf4XNw5jXQqe2OgGMsDBeiWusPmI11cKGY0SIdeSBYQ7Msy-2BwvgKvsQuCY45YibZ81bBWphd9bMXDBlRdOOOAFa4r-2FXofpv12rTaj5qnz8tKYxutaeTLXs7NE5ZJl-2FDDlTr9joGcGTaHbYDykzcggKL2ibEG6wdyI-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;">

</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>