<div><div>Another possibility, other than generics, would be to drop rethrows all together and have the compiler infer if a throw is possible or not, including:</div></div><div><br></div><div><div class="gmail_msg">    struct FStore {</div><div class="gmail_msg">        let f: () throws -&gt; Void</div><div class="gmail_msg">        func call() throws { try f() }</div><div class="gmail_msg">    }</div></div><div class="gmail_msg"><br></div><div class="gmail_msg">The compiler can make two versions, one if f can throw and one if it definitely doesn&#39;t. </div><div class="gmail_msg"><br></div><div class="gmail_msg">Just a thought. </div><div><br><div class="gmail_quote"><div>On Tue, 10 Jan 2017 at 4:29 pm, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com">jtbandes@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 class="gmail_msg">Moving to swift-users list.<div class="gmail_extra gmail_msg"><br clear="all" class="gmail_msg"><div class="gmail_msg"><div class="m_3804435008049710637m_9079363423569745951gmail_signature gmail_msg" data-smartmail="gmail_signature"><div class="gmail_msg"><div class="gmail_msg">No, there&#39;s no way to do this today. The point of rethrows is that within one call site, &quot;f(block)&quot; can be treated as throwing if the block throws, or not throwing if the block doesn&#39;t throw. In your example, once the FStore object is constructed, the information about the original passed-in function is lost, so the caller has no way to know whether call() can throw or not.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If this *were* possible, the information would somehow need to be encoded in the type system when creating FStore(f: block). That would require something like dependent typing, or generic-param-based-rethrows, e.g.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">struct FStore&lt;T: () throws -&gt; Void&gt; {  // made-up syntax</div><div class="gmail_msg">    let f: T</div><div class="gmail_msg">    func call() rethrows(T) { try f() }  // throws-ness of this function depends on throws-ness of T</div><div class="gmail_msg">}</div></div></div></div><br><br><br class="gmail_msg"><div class="gmail_quote gmail_msg"></div></div></div><div class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Mon, Jan 9, 2017 at 9:21 PM, Howard Lovatt via swift-evolution <span class="gmail_msg">&lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br class="gmail_msg"></div></div></div><div class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_msg">Hi,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If I have an escaping function that I store and then call, I need to declare the calling function as throwing, not rethrowing. EG:</div><div class="gmail_msg"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><p class="m_3804435008049710637m_9079363423569745951m_-6115875790740195702gmail-p1 gmail_msg"><span class="m_3804435008049710637m_9079363423569745951m_-6115875790740195702gmail-s1 gmail_msg">    </span>struct FStore {<br class="gmail_msg">        let f: () throws -&gt; Void<br class="gmail_msg">        init(f: @escaping () throws -&gt; Void) { self.f = f }<br class="gmail_msg">        func call() throws { try f() } // Can&#39;t put rethrows here - have to use throws<br class="gmail_msg">    }</p></div><div class="gmail_msg">Is there a better solution?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks for any suggestions,</div><div class="gmail_msg"><br clear="all" class="gmail_msg"><div class="gmail_msg"><div class="m_3804435008049710637m_9079363423569745951m_-6115875790740195702gmail_signature gmail_msg">  -- Howard.<br class="gmail_msg"></div></div><br><br></div></div><br><br><br class="gmail_msg"></blockquote></div></div></div><div class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br class="gmail_msg"><br><br>swift-evolution mailing list<br class="gmail_msg"><br><br><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><br><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"><br><br><br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div></div><br><br></blockquote></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature">-- Howard.</div>