<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="">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 class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 2:04 PM, David Waite <<a href="mailto:david@alkaline-solutions.com" class="">david@alkaline-solutions.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">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 class=""><br class=""></div><div class="">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. </div><div class=""><br class=""></div><div class="">To keep code clarity, use of methods/functions which shadow something in higher lexical scope should likely result in compiler errors.</div><div class=""><br class=""></div><div class="">-DW</div><div class=""><br class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 1:48 PM, ilya 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 style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap;" class="">I applaud honest description of drawbacks in the proposal :) <br class=""><br class="">There examples given, I think, demonstrate that using self without any special access leads to unresolvable ambiguities. <br class=""><br class="">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 class=""><br class="">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 class=""><br class="">Hopefully I don't sounds too pessimistic. Erica's proposal looks going in the right direction to me. <br class=""></div><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr" class="">On Sun, Dec 6, 2015 at 23:30 Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""></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;" class=""><div class="">It's probably better at this point for me to collect my thoughts and summarize where I am at.</div><div class=""><br class=""></div><div class=""><a href="https://gist.github.com/erica/eb32feb22ba99629285a" target="_blank" class="">https://gist.github.com/erica/eb32feb22ba99629285a</a></div><div class=""><br class=""></div><div class="">Please feel free to comment on-list about this proposal (github does not forward comment alerts) and</div><div class="">then I will start a new list thread as a Proposal rather than as a Request for Discussion.</div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">-- E</div></div><div style="word-wrap: break-word;" class=""><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 12:45 PM, ilya <<a href="mailto:ilya.nikokoshev@gmail.com" target="_blank" class="">ilya.nikokoshev@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Sorry, did I misunderstand the question? <div class=""><br class=""></div><div class="">Did you asked whether my definition will work for immutable value types? </div><div class="">If that's the question, the answer is still yes, the link has an example :) </div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Dec 6, 2015 at 10:43 PM, Erica Sadun<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:erica@ericasadun.com" target="_blank" class="">erica@ericasadun.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class=""><div class="">I was specifically referring to value types. I apologize for not being clearer.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- E</div></font></span><div class=""><div class=""><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 12:42 PM, ilya <<a href="mailto:ilya.nikokoshev@gmail.com" target="_blank" class="">ilya.nikokoshev@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Yes, it works for immutable objects with the correct definition, see the playground contents at<span class="Apple-converted-space"> </span><a href="https://github.com/ilyannn/iOS-Swift-Materials/blob/master/Playgrounds/Configure.playground/Contents.swift" target="_blank" class="">https://github.com/ilyannn/iOS-Swift-Materials/blob/master/Playgrounds/Configure.playground/Contents.swift</a></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Dec 6, 2015 at 8:10 PM, Erica Sadun<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:erica@ericasadun.com" target="_blank" class="">erica@ericasadun.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class=""><div class="">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" class="">http://ericasadun.com/2015/11/15/speeding-up-swift-playgrounds-with-closure-initialization-swiftlang/</a>).</div><div class=""><br class=""></div><div class="">Is yours capable of handling enums and structs that would otherwise be let after declaration because mine is not.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div><br class=""></font></span><div class=""><blockquote type="cite" class=""><div class=""><div class=""><div class="">On Dec 5, 2015, at 5:16 PM, ilya via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class=""></div></div><div class=""><div class=""><div class=""><div dir="ltr" class="">> PROBLEM: With many Apple-supplied classes, typical initializers fail to fully set up an instance for use. Here's one example: ...<div class=""><br class=""></div><div class="">FWIW, I created a configuration operator more then a year ago, and use it in all of my Swift projects:</div><div class=""><br class=""></div><div class=""><div class="">let task = NSTask() +=+ {</div><div class=""> <span class="Apple-converted-space"> </span>$0.launchPath = "/usr/bin/mdfind"</div><div class=""> <span class="Apple-converted-space"> </span>$0.arguments = ["kMDItemDisplayName == *.playground"]</div><div class=""> <span class="Apple-converted-space"> </span>$0.standardOutput = pipe</div><div class="">}</div><div class=""><br class=""></div><div class="">Note you can also use the configured object in the rhs:</div><div class=""><br class=""></div><div class=""><div class="">let questionLabel = UILabel() +=+ {</div><div class=""> <span class="Apple-converted-space"> </span>$0.textAlignment = .Center</div><div class=""> <span class="Apple-converted-space"> </span>$0.font = UIFont(name:"DnealianManuscript", size: 72)</div><div class=""> <span class="Apple-converted-space"> </span>$0.text = currentQuestion.questionText</div><div class=""> <span class="Apple-converted-space"> </span>$0.numberOfLines = 0</div></div><div class=""> <span class="Apple-converted-space"> </span>view.addSubview($0)</div><div class="">}</div><div class=""><br class=""></div></div><div class="">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 class=""><br class=""></div><div class=""><div class="">let questionLabel = UILabel() +=+ {</div><div class=""> <span class="Apple-converted-space"> </span>.textAlignment = .Center</div><div class=""> <span class="Apple-converted-space"> </span>.font = UIFont(name:"DnealianManuscript", size: 72)</div><div class=""> <span class="Apple-converted-space"> </span>.text = currentQuestion.questionText</div><div class=""> <span class="Apple-converted-space"> </span>.numberOfLines = 0</div><div class=""> <span class="Apple-converted-space"> </span>view.addSubview($0)</div><div class="">}</div></div><div class=""><br class=""></div><div class="">Actually I would be happy with something like</div><div class=""><br class=""></div><div class=""><div class="">let questionLabel = UILabel() .{</div><div class=""> <span class="Apple-converted-space"> </span>..textAlignment = .Center</div><div class=""> <span class="Apple-converted-space"> </span>..font = UIFont(name:"DnealianManuscript", size: 72)</div><div class=""> <span class="Apple-converted-space"> </span>..text = currentQuestion.questionText</div><div class=""> <span class="Apple-converted-space"> </span>..numberOfLines = 0</div><div class=""> <span class="Apple-converted-space"> </span>view.addSubview($0)</div><div class="">}</div></div><div class=""><br class=""></div><div class="">Other thoughts?</div><div class=""><br class=""></div><div class=""> </div></div></div></div><span class=""><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;" class=""><span class="Apple-converted-space"> </span>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></span></div></blockquote></div><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""><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;" class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></body></html>