<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, May 17, 2016 at 9:03 PM Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm in favor, with one small concern:<br>
<br>
> Then, the protocol author is responsible for providing a generic global trampoline operator that is constrained by the protocol type and delegates to the static operator on that type:<br>
><br>
> func == <T: Equatable>(lhs: T, rhs: T) -> Bool {<br>
> return T.==(lhs, rhs)<br>
> }<br>
<br>
This trampoline operator, and all of the others in the proposal, appears to be 100% pure boilerplate. Could Swift generate them for us?<span style="line-height:1.5"> </span><br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
(Specifically, I'm suggesting that if protocol P defines a `static func $!(args) -> ret`, Swift should automatically generate a global `func #! <T: P> (args) -> ret`, substituting `T` for any `Self`s among the parameters or return values.)<br></blockquote><div><br></div><div>That was actually part of the original write-up :) You can see the removed content from the diff here: <a href="https://github.com/apple/swift-evolution/pull/283/commits/841514fbd7d11ce1ab6dad8ee3c6473d6c550789">https://github.com/apple/swift-evolution/pull/283/commits/841514fbd7d11ce1ab6dad8ee3c6473d6c550789</a></div><div><br></div><div>The core team felt that auto-generating the trampolines was too ambitious for the Swift 3 timeline but that the rest of the improvements should not be held up by it. I definitely intend to propose auto-trampolines as a natural follow-up proposal to this (assuming it's accepted) for Swift 3.x/4.</div><div><br></div></div></div>