<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 15, 2016, at 1:07 PM, Chris Lattner <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 15, 2016, at 11:27 AM, David Owens II <<a href="mailto:david@owensd.io" class="">david@owensd.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hmm... I don't think this is clearer:<div class=""><br class=""></div><div class=""><font face="Menlo" class=""> let fn: (Int) -> (Int) -> Int</font></div><div class=""><br class=""></div><div class="">I think it's much less readable and really, the () are syntactically redundant: the -> is really what distinguishes this as a function.</div><div class=""><br class=""></div><div class="">Also, this would look like a error now:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class=""> let fn: (Int) -> ()</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">Did the user mean that it returns nothing, or did they forget the rest of the function signature?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Hi David,</div><div class=""><br class=""></div><div class="">I’m not sure what you’re saying here. The two types above are already valid, and this proposal doesn’t affect that.</div><div class=""><br class=""></div><div class="">-Chris</div></div></div></div></blockquote><div><br class=""></div><div>At the core, I guess it’s just a dislike of the different behaviors for function declarations in the system in general. Your propose just exposes a weirdness with empty parameter lists and the typealias for void: ().</div><div><br class=""></div><div>It’s a bit odd that the () mean different things depending on the side of the “->” they are on. The left side is an empty parameter list, the right side is a void type.</div><div><br class=""></div><div>Now, I get your argument is to get rid of the difference between:</div><div><br class=""></div><div><div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><font face="Menlo" class=""> let f: Int -> ()</font></div></div></div></div></div></div></div><div class=""><font face="Menlo" class=""> let g: (Int, Int) -> ()</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">I guess I’m more of the opinion of David Hart, this change should also remove the typealias for () being void.</div><div class=""><br class=""></div><div class=""><div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><font face="Menlo" class=""> let f: (Int) -> Void</font></div></div></div></div></div></div></div><div class=""><font face="Menlo" class=""> let g: (Int, Int) -> Void</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><br class=""></div><div class="">Overall, I think the change is ok, but doesn’t really add any significant clarity to function declarations. I feel like there are already a lot of weirdness in general around them.</div><div class=""><br class=""></div><div class="">See:</div><div class=""><br class=""></div></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><div><div class=""><font face="Menlo" class="">typealias Functor = (to: Int, from: Int) -> Int</font></div></div></div><div><div><div class=""><font face="Menlo" class="">let g: (hi: Int, bye: Int) -> Int = { $0 - $1 }</font></div></div></div><div><div><div class=""><font face="Menlo" class=""><br class=""></font></div></div></div><div><div><div class=""><font face="Menlo" class="">func sum(x: Int, y: Int) -> Int {</font></div></div></div><div><div><div class=""><font face="Menlo" class=""> return x + y</font></div></div></div><div><div><div class=""><font face="Menlo" class="">}</font></div></div></div><div><div><div class=""><font face="Menlo" class=""><br class=""></font></div></div></div><div><div><div class=""><font face="Menlo" class="">func mult(x: Int, y: Int) -> Int {</font></div></div></div><div><div><div class=""><font face="Menlo" class=""> return x * y</font></div></div></div><div><div><div class=""><font face="Menlo" class="">}</font></div></div></div><div><div><div class=""><font face="Menlo" class=""><br class=""></font></div></div></div><div><div><div class=""><font face="Menlo" class="">func f(n: Int, _ m: Int, _ c: Functor) -> Int {</font></div></div></div><div><div><div class=""><font face="Menlo" class=""> return c(to: n, from: m)</font></div></div></div><div><div><div class=""><font face="Menlo" class="">}</font></div></div></div><div><div><div class=""><font face="Menlo" class=""><br class=""></font></div></div></div><div><div><div class=""><font face="Menlo" class=""><br class=""></font></div></div></div><div><div><div class=""><font face="Menlo" class="">f(1, 2, sum) // output: 3</font></div></div></div><div><div><div class=""><font face="Menlo" class="">f(1, 2, mult) // output: 2</font></div></div></div><div><div><div class=""><font face="Menlo" class="">f(1, 2, g) // output: -1</font></div></div></div></blockquote><div><div><div class=""><br class=""></div><div class="">It’s weird to me that we can essentially erase the parameter names and fallback to just the type signatures, but that can be a talk for another day.</div><div class=""><br class=""></div><div class="">-David</div></div></div><br class=""></body></html>