<div dir="ltr">I meant to state otherwise I have to fallback on IUO to make it work cleanly...<div><br></div><div><div>    public func finish() throws -&gt; ([String:String],InputStream) {</div><div>        var formHeaders: [String:String]!</div><div>        var formStream: InputStream!</div><div>        try finish({ (fh, fs, _) in</div><div>            formHeaders = fh</div><div>            formStream = fs</div><div>        })</div><div>        return (formHeaders, formStream)</div><div>    }</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 2, 2017 at 12:33 PM Shawn Erickson &lt;<a href="mailto:shawnce@gmail.com">shawnce@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">I attempted the following code which involves passing a closure – one that doesn&#39;t escape obviously – but the compiler complains that I need to make formHeaders and formStream vars.<div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">    public func finish() throws -&gt; ([String:String],InputStream) {</div><div class="gmail_msg">        let formHeaders: [String:String]</div><div class="gmail_msg">        let formStream: InputStream</div><div class="gmail_msg">        try finish({ (fh, fs, _) in</div><div class="gmail_msg">            formHeaders = fh</div><div class="gmail_msg">            formStream = fs</div><div class="gmail_msg">        })</div><div class="gmail_msg">        return (formHeaders, formStream)</div><div class="gmail_msg">    }</div></div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If I have code like this however the use of let is ok.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg">    public func finish() throws -&gt; ([String:String],InputStream) {</div><div class="gmail_msg">        let formHeaders: [String:String]</div><div class="gmail_msg">        let formStream: InputStream</div><div class="gmail_msg">        if self.finalized.get() {</div><div class="gmail_msg">            formHeaders = [&quot;foo&quot;:&quot;bar&quot;]</div><div class="gmail_msg">            //formStream = ...</div><div class="gmail_msg">        }</div><div class="gmail_msg">        else {</div><div class="gmail_msg">            formHeaders = [:]</div><div class="gmail_msg">            //formStream = ...</div><div class="gmail_msg">            // or throw something here</div><div class="gmail_msg">        }</div><div class="gmail_msg">        return (formHeaders, formStream)</div><div class="gmail_msg">    }</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If the closure is non-escaping and the code as structured the compiler should be able to reason about the initialization correctness of those lets...? ...or am I missing something?</div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">-Shawn</div></div></blockquote></div>