<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="">I think there’s some value to point out these counterparts even when we are trying to do something new. Specifically, how much would we have lost, if we didn’t accept the proposal? By looking at these examples, one might conclude “not much”.<div class=""><br class=""></div><div class="">Also, it’s not the main reason I’m against this change.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 8:06 PM, Jaden Geller <<a href="mailto:jaden.geller@gmail.com" class="">jaden.geller@gmail.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 don't disagree with discussing other languages. I'm just pointing out that C++ doesn't have a notion of computed properties, so subscript couldn't pretend to be a computed property even if it'd like! Python does have a similar construct, but it's computed properties *also* look like functions (you first define a set_foo() and a get_foo() before making the property) so it is also not relevant.<div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 7:24 PM, Duan <<a href="mailto:daniel@duan.org" class="">daniel@duan.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><div style="direction: inherit;" class="">It's part of the review template :)</div><br class=""><div class="">Daniel Duan</div>Sent from my iPhone</div><div class=""><br class="">On Jul 20, 2016, at 7:23 PM, Jaden Geller <<a href="mailto:jaden.geller@gmail.com" class="">jaden.geller@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class=""><div style="direction: inherit;" class=""></div></div><blockquote type="cite" class=""><div class=""><div style="direction: inherit;" class="">Python's __getitem__() method, C++'s [] operator are some analogous examples. Non -of them pretend not to be a function. The users of these features appear to be satisfied by the decision.</div></div></blockquote><div class=""><br class=""></div><div class="">This seems irrelevant since Swift already has computed properties which pretend not to be a function.</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 7:13 PM, Duan 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=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">* What is your evaluation of <a href="x-apple-data-detectors://3" dir="ltr" x-apple-data-detectors="true" x-apple-data-detectors-type="misc" x-apple-data-detectors-result="3" style="-webkit-text-decoration-color: rgba(0, 0, 0, 0.258824);" class="">the proposal</a>?</span></div><div style="direction: inherit;" class=""><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">-1. </div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">To me, subscripts have always seen more functions than properties for the fact that they can take arbitrary number of arguments. If we were to "clean up" its syntax, I'd rather align it with functions. Something along the lines of</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class=""> subscribe(get) func foo(_ x: X) -> Y</div><div style="direction: inherit;" class=""> subscribe(set) func foo(_ y: Y)</div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""> * Is the problem being addressed significant enough to warrant a change to Swift?</span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">No. More importantly, the change is a regression visually.</span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">* Does this proposal fit well with the feel and direction of Swift?</span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">It's an attempt of a syntax dress-up.</span></div><div style="direction: inherit;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><span style="background-color: rgba(255, 255, 255, 0);" class="">* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?</span></div><div style="direction: inherit;" class=""><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">Python's __getitem__() method, C++'s [] operator are some analogous examples. Non -of them pretend not to be a function. The users of these features appear to be satisfied by the decision.</div><div style="direction: inherit;" class=""><br class=""></div><span style="background-color: rgba(255, 255, 255, 0);" class=""> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</span></div><div style="direction: inherit;" class=""> </div><div style="direction: inherit;" class="">Quick read of proposal and discussion on ML.</div><div style="direction: inherit;" class=""><br class=""></div><div class="">Daniel Duan</div>Sent from my iPhone</div><div class=""><br class="">On Jul 20, 2016, at 10:17 AM, Jose Cheyo Jimenez via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 7:51 AM, Vladimir.S 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="">+1 to clean up the syntax of subscripts. They acts as properties, not methods, so it is natural to express them with `:` and not with `->`.<br class=""><br class="">Actually, I'd prefer additional change to use [] instead of () in declaration like:<br class=""><br class="">subscript[externalName internalName: ParamType] : ElementType {<br class=""> get { … }<br class=""> set { … }<br class="">}<br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">I got to second this suggestion. To me this is an elegant solution. </div><div class=""><br class=""></div><div class="">If subscripts are so special that Swift decided to give it its own name (as oppose to just making it two functions), </div><div class="">why not declare it in a special way like the above?</div><div class=""><br class=""></div><div class="">I think that in addition to replacing -> with : if we replaced () with [] then it would be much clearer that this is not a function or property. </div><div class=""><br class=""></div><div class=""><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(51, 51, 51); widows: 1; background-color: rgb(247, 247, 247);" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; background-position: initial initial; background-repeat: initial initial;" class="">subscript[externalName internalName: ParamType] : ElementType {
get { … }
set { … }
}</code></pre><div class=""><br class=""></div><div class="">I don’t see another place in the language where [] would make more sense than here: </div><div class="">Otherwise I don’t see replacing -> with : as a big win like Dmitri Gribenko said down thread -></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><blockquote type="cite" class="">I think by changing subscripts to use colons we would end in the opposite, but<br class="">totally symmetrical situation compared to what we have now.<br class=""></blockquote></blockquote></div><div class=""><br class=""></div></div><div class=""> </div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">especially if thinking about "Future directions" and confusion with parameterised accessor syntax(both declared with `()` but first used with `[]` and second with `()`).<br class=""><br class="">On 20.07.2016 8:50, Chris Lattner via swift-evolution wrote:<br class=""><blockquote type="cite" class="">Hello Swift community,<br class=""><br class="">The review of "SE-0122: Use colons for subscript declarations " begins now and runs through July 24. The proposal is available here:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0122-use-colons-for-subscript-type-declarations.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0122-use-colons-for-subscript-type-declarations.md</a><br class=""><br class="">Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class="">or, if you would like to keep your feedback private, directly to the review manager.<br class=""><br class="">What goes into a review?<br class=""><br class="">The goal of the review process is to improve the proposal under review through constructive criticism and contribute to the direction of Swift. When writing your review, here are some questions you might want to answer in your review:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* What is your evaluation of the proposal?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* Is the problem being addressed significant enough to warrant a change to Swift?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* Does this proposal fit well with the feel and direction of Swift?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""><br class="">More information about the Swift evolution process is available at<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="">https://github.com/apple/swift-evolution/blob/master/process.md</a><br class=""><br class="">Thank you,<br class=""><br class="">-Chris Lattner<br class="">Review Manager<br class=""><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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></blockquote></div><br class=""></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>