<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div><div><br><br>Sent from my iPhone</div>On Apr 13, 2017, at 07:34, Jeff Kelley <<a href="mailto:slaunchaman@gmail.com">slaunchaman@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">Apologies if this has been suggested before, but going off of Andrew’s message, a simple syntax could be to use our existing Optional syntax:<div class=""><br class=""></div><div class=""><font face="Menlo" class="">let array = ["foo", "bar", "baz"]</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">let first = array[0] // type is `String`</font></div><div class=""><font face="Menlo" class="">let third = array[2?] // type is `String?`, value is .some("baz")</font></div><div class=""><font face="Menlo" class="">let fourth = array[3?] // type is `String?`, value is .none</font></div></div></blockquote><br><div>That was my thought, too, but it's not valid Swift. I tried it in a playground before I sent my reply. At least in Xcode 8.3.1, it gives an error about ambiguous calls (it can't decide if you're trying to call the stdlib subscript or the `(_: Index?) -> Element?` one from the extension), and if you fix that by adding an argument label, the real issue is revealed which is that saying "x?" doesn't return "x wrapped in an optional"; it thinks you're trying to do Optional chaining on a non-optional value, which isn't allowed.</div><div><br></div><div>I wouldn't object to adding that "trailing '?' wraps the value" behavior (or maybe "¿", since they really would have the opposite result), in which case this should work fine (although the choice of argument label, or lack thereof, will likely still be bikeshedded)</div><div><br></div><div>Anyway, unless someone who knows more about this than I do (probably most of you) says this functionality is a Bad Idea (<span style="background-color: rgba(255, 255, 255, 0);">™), I'm in favor of it.</span></div><div><br></div><div>- Dave Sweeris</div></body></html>