<div dir="ltr"><div><font color="#500050"><span style="font-size:12.800000190734863px">I too have a little trouble with the suggested trampoline syntax:</span></font></div><div><font color="#500050"><span style="font-size:12.800000190734863px"><br></span></font></div><div><span style="color:rgb(80,0,80);font-size:12.800000190734863px">> static prefix func ++(value: inout Self) -> Self</span><br style="color:rgb(80,0,80);font-size:12.800000190734863px"><span style="color:rgb(80,0,80);font-size:12.800000190734863px">> static postfix func ++(value: inout Self) -> Self</span><br></div><div><span style="color:rgb(80,0,80);font-size:12.800000190734863px"><br></span></div><div><font color="#500050"><span style="font-size:12.800000190734863px">I agree with Brent that the most appropriate way to write the trampoline itself would be something more like:</span></font></div><div><font color="#500050"><span style="font-size:12.800000190734863px"><br></span></font></div><div><font color="#500050"><span style="font-size:12.800000190734863px">```</span></font></div><div><font color="#500050"><span style="font-size:12.800000190734863px">static func ++ (prefix value: inout Self) -> Self</span></font></div><div><font color="#500050"><span style="font-size:12.800000190734863px">```</span></font></div><div><span style="color:rgb(80,0,80);font-size:12.800000190734863px"><br></span></div><div><font color="#500050"><span style="font-size:12.800000190734863px">No particular need to eliminate declaration modifiers altogether quite yet for the non-trampoline operators. The reasoning is this: a "prefix func" or a "postfix func" would be used at the call site by actually prefixing or postfixing the value. By contrast, the trampoline functions are called like any other static member -- i.e. `T.++(prefix: foo)` -- and thus the function itself is not really a "prefix func" or a "postfix func", just a func with a parameter label.</span></font></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 9:57 PM, Brent Royal-Gordon via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">> Additionally, I am generally +1 for the same reasons as Brent, but I<br>
> have another caveat as well:<br>
><br>
> Defining prefix and postfix functions looks like this in the proposal:<br>
><br>
> static prefix func ++(value: inout Self) -> Self<br>
> static postfix func ++(value: inout Self) -> Self<br>
><br>
> yet the proposal suggests calling them this way from these boilerplate<br>
> methods:<br>
><br>
> prefix func ++ <T: SomeProtocol>(value: inout T) -> T {<br>
> return T.++(prefix: &value)<br>
> }<br>
> postfix func ++ <T: SomeProtocol>(value: inout T) -> T {<br>
> return T.++(postfix: &value)<br>
> }<br>
<br>
</span>I actually found this bizarre too, but forgot to mention it. My suggested solution runs in the other direction: We should require that *all* unary operator declarations and references use `prefix` or `postfix` as a parameter label. Thus, the trampoline operators themselves would be written as:<br>
<br>
func ++ <T: SomeProtocol>(prefix value: inout T) -> T {<br>
return T.++(prefix: &value)<br>
}<br>
<br>
func ++ <T: SomeProtocol>(postfix value: inout T) -> T {<br>
return T.++(postfix: &value)<br>
}<br>
<br>
Not would be written as:<br>
<br>
func ! <B: BooleanType>(prefix value: B) -> Bool<br>
<br>
While force-unwrap (if we had inout return values) would be written:<br>
<br>
func ! <T>(postfix value: inout Optional<T>) -> inout T<br>
<br>
`prefix` and `postfix` would be eliminated from the language as declaration modifiers, except when declaring custom operators (which is already the Land Of Ad-Hoc Syntax).<br>
<span class=""><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
</font></span><div class=""><div class="h5"><br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div></div>