<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>I agree. I'm +1 for the proposal, but it should be possible for a T to resolve to an arguments-list type tuple. As I don't often think like a compiler, I don't know if that would be made harder or easier as a result of this proposal.<br></div>
<div> </div>
<div id="sig40804545"><div class="signature">Zachary Waldowski<br></div>
<div class="signature"><a href="mailto:zach@waldowski.me">zach@waldowski.me</a><br></div>
<div> </div>
</div>
<div> </div>
<div>On Wed, Jan 27, 2016, at 12:27 PM, Dave via swift-evolution wrote:<br></div>
<blockquote type="cite"><div>Fair enough. Can we get an explicit, well-designed version of this before we get rid of the implicit, poorly-designed version?<br></div>
<div> </div>
<div>I can’t recall off the top my head where, but I <i>know</i> I’ve done something like this:<br></div>
<div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">struct</span> FunctionApplicator <T, U> {<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">var</span> args: <span class="colour" style="color:rgb(112, 61, 170)">T</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">let</span> function: <span class="colour" style="color:rgb(112, 61, 170)">T</span> -> <span class="colour" style="color:rgb(112, 61, 170)">U</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">init</span>(args: <span class="colour" style="color:rgb(112, 61, 170)">T</span>, function: <span class="colour" style="color:rgb(112, 61, 170)">T</span> -> <span class="colour" style="color:rgb(112, 61, 170)">U</span>) {<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">self</span>.<span class="colour" style="color:rgb(79, 129, 135)">args</span> = args<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">self</span>.<span class="colour" style="color:rgb(79, 129, 135)">function</span> = function<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"> }<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">func</span> apply() -> <span class="colour" style="color:rgb(112, 61, 170)">U</span> {<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79, 129, 135);"><span class="colour" style="color:rgb(0, 0, 0)"></span><span class="colour" style="color:rgb(187, 44, 162)">return</span><span class="colour" style="color:rgb(0, 0, 0)"></span>function<span class="colour" style="color:rgb(0, 0, 0)">(</span>args<span class="colour" style="color:rgb(0, 0, 0)">)</span><br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"> }<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;">}<br></div>
</div>
<div> </div>
<div>Without tuple splatting, you’d need a <span class="font" style="font-family:Menlo"><span class="size" style="font-size:11px">FunctionApplicator1<T,U></span></span>, <span class="font" style="font-family:Menlo"><span class="size" style="font-size:11px">FunctionApplicator2<T,U,V></span></span>, <span class="font" style="font-family:Menlo"><span class="size" style="font-size:11px">FunctionApplicator3<T,U,V,W></span></span>, etc. They can’t even have the same name because Swift doesn’t support overloading type names for types with a different number of generic parameters.<br></div>
<div><div> </div>
<div>- Dave Sweeris<br></div>
<div> </div>
<div><blockquote type="cite"><div>On Jan 27, 2016, at 08:48, Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div>
<div> </div>
<div><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;" type="cite"><div> </div>
<div>On Jan 27, 2016, at 4:18 AM, Nisse Bergman via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div>
<div> </div>
<div>-1 I use this in both my mocking API and in JSON deserialising/serializing.<br></div>
<div>I think this is a great thing to have<br></div>
</blockquote><div> </div>
<div><span class="font" style="font-family:Helvetica"><span class="size" style="font-size:12px">It would be great to have an explicit, well-designed version of this. Nobody is arguing against that. But there are quite a few problems with its current form.</span></span><br></div>
</div>
</blockquote></div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div> </div>
</body>
</html>