<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span style="background-color: rgba(255, 255, 255, 0);">If we could have extensions on AnyObject, a simple .bridge() would do the trick, right? (Assuming bridge was generic.) I think something along those lines was mentioned in the proposal.</span><br><br>Sent from my iPhone</div><div><br>On May 23, 2016, at 5:26 PM, Jordan Rose 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 class="">I am way late, but I share Brent’s concerns. I don’t think this addresses the very common case of “getting a String out of a heterogeneous dictionary”.</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">let name = plist[“name”] as! String</blockquote><div class=""><br class=""></div>becomes one of these:<div class=""><br class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">let name = plist[“name”] as! NSString as String</blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">let name = String(plist[“name”] as! NSString)</blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">let name = String(forceBridging: plist[“name”]) // not in the proposal</blockquote><div class=""><br class=""></div>none of which I’m particularly happy with.&nbsp;<br class=""><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 19, 2016, at 02:31, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* What is your evaluation of the proposal?<br class=""></blockquote><br class="">The review is technically over, but I don't believe a decision has been announced yet, so...<br class=""><br class="">I am generally in favor, but I have a serious concern about the readability of certain conversions with this change. To wit, conversions like these:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>myArray as! [NSView]<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>myDictionary as! [String: NSView]<br class=""><br class="">Are about to become something more like these:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>[NSView](forcedLazyBridging: myArray)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>[String: NSView](forcedLazyBridging: myDictionary)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class="">Or these:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Array&lt;NSView&gt;(forcedLazyBridging: myArray)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Dictionary&lt;String, NSView&gt;(forcedLazyBridging: myDictionary)<br class=""><br class="">Either option is a significant regression in code readability compared to the status quo.<br class=""><br class="">It's enough to make me wonder if we shouldn't have special-cased conversion methods for NSArray, NSDictionary, and NSSet:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>myArray.of(NSView)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>// returns [NSView]<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>myDictionary.of(NSView, for: String) <span class="Apple-tab-span" style="white-space:pre">        </span>// returns [String: NSView]<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>mySet.of(NSView)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>// returns Set&lt;NSView&gt;<br class=""><br class="">On the other hand, if you *don't* have to specify an element type, these aren't so bad:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Array(forcedLazyBridging: myArray)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Dictionary(forcedLazyBridging: myDictionary)<br class=""><br class="">And it gets even better if you use something a little saner than `forcedLazyBridging` for the label.<br class=""><br class=""><blockquote type="cite" 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=""></blockquote><br class="">Yes. Conversions are a mess, and it'll be nice to clean them up.<br class=""><br class=""><blockquote type="cite" 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=""></blockquote><br class="">Yes.<br class=""><br class=""><blockquote type="cite" 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=""></blockquote><br class="">Most languages I've used have had much simpler cast systems with nothing particularly close to Swift's bridging casts.<br class=""><br class=""><blockquote type="cite" 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=""></blockquote><br class="">Quick reading.<br class=""><br class="">-- <br class="">Brent Royal-Gordon<br class="">Architechies<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">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></blockquote></div><br class=""></div></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>