<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=""><div><blockquote type="cite" class=""><div class="">On Aug 18, 2016, at 10:11 AM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><div class=""><div dir="ltr" class=""><div class="">On Thu, Aug 18, 2016 at 11:30 AM, John McCall <span dir="ltr" class="">&lt;<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>&gt;</span> wrote:<br class=""></div></div><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Aug 18, 2016, at 8:46 AM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><div class="">The issue would be that, in the case of "try? foo()", nil and .some(nil) might mean very different things.<br class=""></div></blockquote><div class=""><br class=""></div></span>This is true of a?.foo() as well.&nbsp; But yes, I think it is more likely that someone would want to treat them differently for try?.</div></div></blockquote><div class=""><br class=""></div></div></div></div><div style="white-space:pre-wrap" class="">Agreed.<br class=""><br class="">My proposed solution was half-baked, but it may be workable--I'm not suggesting typing decisions based on a dynamic property, of course. It'd be something like this:<br class=""><br class="">`as?` would&nbsp;produce a result of a type named something like CastingOptional&lt;T&gt;, which on assignment or essentially any other operation is promoted/bridged/[insert much more correct term here] to an Optional&lt;T&gt; like how T is automatically promoted to Optional&lt;T&gt;. However, `try?` will not wrap a CastingOptional&lt;T&gt; into an Optional&lt;Optional&lt;T&gt;&gt;.</div></div></blockquote><div><br class=""></div>The way this is done for ?-chaining is that the result of the chain is coerced to T?, for a fresh unbound type T. &nbsp;If the result is already of type U?, T will be bound to U and there's no "stacking" of optionals; if the result is a non-optional type V, T will be bound to V and therefore the chain gains a level of optionality. &nbsp;I think that is simpler and more consistent than inventing a new flavor of Optional with complex conversion and defaulting rules.</div><div><br class=""></div><div>John.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><span class=""><font color="#888888" class=""><div class="">John.</div></font></span><div class=""><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Aug 18, 2016 at 10:40 John McCall &lt;<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 18, 2016, at 8:19 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class="">Lots of interesting points here. I do think there's an improvement possible here, but it's actually along the lines of Sam's original suggestion #3 (not vis-a-vis all of Swift, but specifically for how try? composes with as?):<div class=""><br class=""></div><div class="">A. I'm in favor of the current behavior where try prefixes an entire statement: it solves the precise issue of multiple nested optionals or multiple unwrapping of optionals in the situation where one statement has calls to many throwing functions. It says instead, I want nil if anything in this statement throws, otherwise, give me .some(value).</div><div class=""><br class=""></div><div class="">Sam--I think you may have misunderstood Charles's explanation. He's not saying "try?" attaches with lower or higher precedence as compared to "as?". Rather, I think the mental model is that "try?" prefixes the whole right-hand side (rhs), and if *any* call on the rhs throws, the whole rhs evaluates to nil, but if *any* call could potentially throw but doesn't, "try?" wraps the entire rhs and gives you .some(value). IMO, this is pretty sensible for the reason he gives.</div><div class=""><br class=""></div><div class="">B. I'm in favor of warning instead of error, for precisely the internal discussion rationale communicated by Slava. I'm willing to live with "try? 42" being only a warning if that means my code won't stop compiling when someone decides a library function doesn't need to throw.</div><div class=""><br class=""></div><div class="">Sam--here, changing warning to error would not solve your original problem, because in that example "try?" does prefix at least one throwing function, so you wouldn't get an error anyway.</div><div class=""><br class=""></div><div class="">C. However, given the thinking in (A), I do think how "try?" composes with "as?" is a little counterintuitive or at least overly ceremonious, though technically it is possible to reason through.</div><div class=""><br class=""></div><div class="">It's true that currently you can use the multiple nested optionals to figure out whether either a throwing function threw (but not which throwing function out of potentially more than one) or whether the cast did not succeed. But, since "try?" after all means "give me nil if anything throws," it kind of makes less sense that you get all this nesting and detailed information when it composes with "as?". If you really wanted that level of detail, you could always evaluate "try?" and "as?" in separate statements. What I'd propose instead is this:</div><div class=""><br class=""></div><div class="">If "try?" is composed with "as?", and "as?" yields "nil", then "try?" should not wrap that value in another optional.</div></div></div></blockquote><div class=""><br class=""></div></div></div><div style="word-wrap:break-word" class=""><div class="">We can't make the typing decision dependent on a dynamic property like whether the cast fails.&nbsp; And I don't like the idea of changing its typing rule based on the form of the nested expression.&nbsp; But we could make "try? foo()" avoid adding an extra level of optionality, the same way that "a?.foo()" does.</div></div><div style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class="">John.</div></div><div style="word-wrap:break-word" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Does that sound sensible?</div><div class=""><div class=""><div class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Aug 18, 2016 at 3:54 AM, Sikhapol Saijit via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 18, 2016, at 3:42 PM, Slava Pestov &lt;<a href="mailto:spestov@apple.com" target="_blank" class="">spestov@apple.com</a>&gt; wrote:</div><br class=""><div class=""><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><br class="">On Aug 18, 2016, at 12:52 AM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><span style="font-family:Helvetica;font-size:12px;font-style: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" class="">Opinions inline:</span><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br class=""></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><blockquote type="cite" class=""><div class="">On 18 Aug 2016, at 07:43, Sikhapol Saijit via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">Hi all,<div class=""><br class=""></div><div class=""><br class=""></div><div class="">Yesterday I tried this code:</div><div class=""><br class=""></div><div class=""><div class=""><div class=""><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(186,45,162)" class="">func</span><span class=""><span class="">&nbsp;</span>couldFailButWillNot()<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">throws</span><span class=""><span class="">&nbsp;</span>-&gt;<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">Any</span><span class=""><span class="">&nbsp;</span>{</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(186,45,162)" class=""><span class="">&nbsp; &nbsp;<span class="">&nbsp;</span></span><span class="">return</span><span class=""><span class="">&nbsp;</span></span><span style="color:rgb(39,42,216)" class="">42</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(49,89,93)" class=""><span style="color:rgb(186,45,162)" class="">if</span><span class=""><span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">let</span><span class=""><span class="">&nbsp;</span>a =<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">try</span><span class="">?<span class="">&nbsp;</span></span><span class="">couldFailButWillNot</span><span class="">()<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">as</span><span class="">?<span class="">&nbsp;</span></span><span style="color:rgb(112,61,170)" class="">Int</span><span class=""><span class="">&nbsp;</span>{</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">&nbsp; &nbsp;<span class="">&nbsp;</span></span><span style="color:rgb(62,30,129)" class="">print</span><span class="">(a)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div><div class=""><span class=""><br class=""></span></div></div></div></div></div><div class="">And was surprised that the output was&nbsp;<b style="font-family:Menlo;font-size:11px" class="">Optional(42)</b>&nbsp;on both Swift 2 and Swift 3.</div><div class="">I always have the impression that when a variable is resolved with&nbsp;<font class=""><span style="font-family:Menlo;color:rgb(186,45,162);font-size:11px" class="">if</span><span style="font-family:Menlo;font-size:11px" class=""><span class="">&nbsp;</span></span><span style="font-family:Menlo;color:rgb(186,45,162);font-size:11px" class="">let</span><span style="color:rgb(186,45,162)" class="">&nbsp;</span>it will never be optional.</font></div><div class=""><br class=""></div><div class="">So, with a little investigation, I found out that it happens because&nbsp;<span style="color:rgb(186,45,162);font-family:Menlo;font-size:11px" class="">as</span><span style="font-family:Menlo;font-size:11px" class="">?</span>&nbsp;has higher precedence than&nbsp;<span style="color:rgb(186,45,162);font-family:Menlo;font-size:11px" class="">try</span><span style="font-family:Menlo;font-size:11px" class="">?</span>&nbsp;and is evaluated first.</div><div class="">And the whole expression<span class="">&nbsp;</span><font face="Menlo" style="font-size:11px" class="">`<span style="color:rgb(186,45,162)" class="">try</span><span class="">? couldFailButWillNot()<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">as</span><span class="">?&nbsp;</span><span style="color:rgb(112,61,170)" class="">Int`</span></font>&nbsp;evaluated as&nbsp;<span style="font-size:11px" class=""><font face="Menlo" class=""><b class="">Optional(Optional(42))</b></font></span>.</div><div class=""><br class=""></div><div class="">Also, I’m surprised that&nbsp;<span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">try</span><span style="font-family:Menlo;font-size:11px" class="">?</span>&nbsp;can be used with non-method-call.</div><div class="">This code:&nbsp;<span style="font-family:Menlo;font-size:11px" class="">`print(</span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">try</span><span style="font-family:Menlo;font-size:11px" class="">?<span class="">&nbsp;</span></span><span style="font-family:Menlo;font-size:11px;color:rgb(39,42,216)" class="">42</span><span style="font-family:Menlo;font-size:11px" class="">)`</span>&nbsp;will print&nbsp;<b style="font-family:Menlo;font-size:11px" class="">Optional(42)</b>.</div><div class=""><br class=""></div><div class="">So, the questions are:</div><div class=""><br class=""></div><div class="">1. Is it intentional that&nbsp;<span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">try</span><span style="font-family:Menlo;font-size:11px" class="">?</span>&nbsp;can be used with a "non-method-call" and return an optional of the type that follows?</div></div></div></blockquote><div class=""><br class=""></div><div class="">I think this is the real solution. try and try? should not be allowed on non-throwing functions or expressions.</div></div></div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br class=""></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">This is a warning right now — do you think it should be an error?</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br class=""></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">Slavas-MacBook-Pro:~ slava$ cat ttt.swift&nbsp;</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">func f() {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255);min-height:13px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">func g() {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">&nbsp; try f()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">&nbsp; try? f()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class=""><br class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">Slavas-MacBook-Pro:~ slava$ swiftc ttt.swift&nbsp;</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class=""><b class="">ttt.swift:4:3:<span class="">&nbsp;</span></b></span><span style="color:rgb(213,59,211)" class=""><b class="">warning:<span class="">&nbsp;</span></b></span><span class=""><b class="">no calls to throwing functions occur within 'try' expression</b></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">&nbsp; try f()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)" class=""><span class=""><b class="">&nbsp; ^</b></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class=""><b class="">ttt.swift:5:8:<span class="">&nbsp;</span></b></span><span style="color:rgb(213,59,211)" class=""><b class="">warning:<span class="">&nbsp;</span></b></span><span class=""><b class="">no calls to throwing functions occur within 'try' expression</b></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span class="">&nbsp; try? f()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)" class=""><span class=""><b class="">&nbsp;&nbsp; &nbsp; &nbsp; ^</b></span></div></div></div></blockquote><div class=""><br class=""></div></div></div><div class=""><div class="">Thank you Slava,</div><div class=""><br class=""></div><div class="">While I think using try/try? on anything but a throwing function call should be an error, right now it even works with anything. `try? 42` will just wrap 42 in an optional and give some warning now.</div></div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">2. Should we design&nbsp;<span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">try</span><span style="font-family:Menlo;font-size:11px" class="">?</span>&nbsp;to have higher precedence than&nbsp;<span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">as</span><span style="font-family:Menlo;font-size:11px" class="">?&nbsp;</span>or any operators at all?</div><div class="">My intuition tells me that&nbsp;</div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(186,45,162)" class="">let</span><span class=""><span class="">&nbsp;</span>a =<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">try</span><span class="">? couldFailButWillNot()<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">as</span><span class="">?<span class="">&nbsp;</span></span><span style="color:rgb(112,61,170)" class="">Int</span></div></div><div class="">should be equivalent to</div><div class=""><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">let</span><span style="font-family:Menlo;font-size:11px" class=""><span class="">&nbsp;</span>a = (</span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">try</span><span style="font-family:Menlo;font-size:11px" class="">? couldFailButWillNot())<span class="">&nbsp;</span></span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)" class="">as</span><span style="font-family:Menlo;font-size:11px" class="">?<span class="">&nbsp;</span></span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)" class="">Int</span>&nbsp;</div></div></div></blockquote><div class=""><br class=""></div><div class="">That’s worth considering. try feels like it should tie very strongly with the throwing expression.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">3. Do you think that doubly-nested optional (or multi-level-nested optional) is confusing and should be removed from Swift? (Yes, I’ve seen this blog post&nbsp;<a href="https://developer.apple.com/swift/blog/?id=12" target="_blank" class="">Optionals Case Study: valuesForKeys</a>).</div><div class="">For me<span class="">&nbsp;</span><font face="Menlo" style="font-size:11px" class=""><b class="">Optional(nil)</b></font><span class="">&nbsp;</span>(aka<span class="">&nbsp;</span><font face="Menlo" style="font-size:11px" class=""><b class="">Optional.Some(Optional.None))</b></font>) doesn’t make much sense.&nbsp;</div><div class="">Maybe, one of the solution is to always have optional of optional merged into a single level optional? Like<span class="">&nbsp;</span><font face="Menlo" style="font-size:11px" class=""><b class="">Optional(Optional(Optional(42)))</b></font><span class="">&nbsp;</span>should be the merged to and evaluated as<span class="">&nbsp;</span><font face="Menlo" style="font-size:11px" class=""><b class="">Optional(42)</b></font>.</div></div></div></blockquote><div class=""><br class=""></div><div class="">I don’t think this is the solution. Even if it was, how would you expect to “remove” them from Swift? Optionals are simply an enum with an associated value. We’d have to introduce a language feature to restrict values that can be stored in enum cases? It sounds awfully complicated.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">BTW, the code above is merely for a demonstration. The actual code was more of something like this:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(186,45,162)" class="">func</span><span class=""><span class="">&nbsp;</span>parse(JSON:<span class="">&nbsp;</span></span><span style="color:rgb(112,61,170)" class="">Data</span><span class="">)<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">throws</span><span class=""><span class="">&nbsp;</span>-&gt;<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">Any</span><span class=""><span class="">&nbsp;</span>{</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span class="">&nbsp; &nbsp;<span class="">&nbsp;</span></span><span class="">// …</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(186,45,162)" class="">if</span><span class=""><span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">let</span><span class=""><span class="">&nbsp;</span>dict =<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">try</span><span class="">? parse(JSON: json)<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">as</span><span class="">? [</span><span style="color:rgb(112,61,170)" class="">String</span><span class="">:<span class="">&nbsp;</span></span><span style="color:rgb(186,45,162)" class="">Any</span><span class="">] {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span class="">&nbsp; &nbsp;<span class="">&nbsp;</span></span><span class="">// assume dict is a valid [String: Any] dictionary</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span class="">&nbsp; &nbsp;<span class="">&nbsp;</span></span><span class="">// …</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">I’m new to this mailing list so I’m not sure if this belongs here. I’m sorry in advance if it doesn’t.</div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">Thank you,</div><div style="margin:0px;line-height:normal" class="">Sam</div></div></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" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div><span style="font-family:Helvetica;font-size:12px;font-style: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" class="">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style: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" class="">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" class="">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></blockquote></div></div></div><br class=""></div><br class="">_______________________________________________<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="">
<br class=""></blockquote></div><br class=""></div></div></div></div></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" target="_blank" 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></div></div>
</div></blockquote></div><br class=""></body></html>