<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><br><br><div id="AppleMailSignature">Sent from my iPad</div><div><br>On Nov 11, 2017, at 5:27 PM, Chris Lattner &lt;<a href="mailto:clattner@nondot.org">clattner@nondot.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8">Ok, which differences?<br><br><div id="AppleMailSignature"><div>-Chris</div></div><div><br>On Nov 11, 2017, at 2:19 PM, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><br><br><div id="AppleMailSignature">Sent from my iPad</div><div><br>On Nov 11, 2017, at 11:40 AM, Chris Lattner &lt;<a href="mailto:sabre@nondot.org">sabre@nondot.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8">On Nov 10, 2017, at 6:10 PM, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><div><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 10, 2017, at 11:25 AM, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="Singleton" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">People have reasonably asked for the ability to make their own function-like types in the past, such that "myvalue(...)" behaves like sugar for "myvalue.call(...)" or something like that. In most cases, they still want to have type system control over what arguments and results their call operation produces. They don't really get that with this proposal; they lose all control over the arity and argument types.<span class="Apple-converted-space">&nbsp;</span></div></div></blockquote><div class=""><br class=""></div><div class="">As I mentioned, this is directly addressed in the writeup. Here’s the link:</div><div class=""><a href="https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d#staticly-checking-for-exact-signatures" class="">https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d#staticly-checking-for-exact-signatures</a></div></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">That discusses why you didn’t include it in the present proposal but I think it’s reasonable to oppose adding a dynamic callable feature prior to a more Swifty static callable.</div></div></div></div></blockquote><br class=""></div><div class="">Why? &nbsp;One does not preclude the other.</div></div></blockquote><div class=""><br class=""></div>For exactly the reason Joe articulates. &nbsp;Some people will use what the language offers to get the syntax they desire even if it sacrifices type safety. &nbsp;If we’re going to have first-class callable types in Swift (I think it’s a great idea) type safety for native code should be prioritized over syntactic convenience for dynamic language interop. &nbsp;We can have both, but the former should come first IMO.</div></div></blockquote><br class=""></div><div>Hi Matthew,</div><div><br class=""></div><div>In point of fact, Swift already has the feature you are referring to. &nbsp;It just spells it with square brackets instead of parentheses. &nbsp;A simple change to the punctuation character has much less point than the proposal that I’m pitching.</div></div></blockquote><div><br></div><div>This is true if you squint, but I imagine a design for callable types would include some&nbsp;</div><div>&nbsp;differences other than just punctuation.</div></div></blockquote></div></blockquote><div><br></div><div>I think there was a pretty good discussion of this distinction in the &nbsp;SE-0021 timeframe. &nbsp;Specifically, subscripts model storage while callable would model functions. &nbsp;This means that subscripts can be used in a key path while callable would not (at last for now). &nbsp;</div><div><br></div><div>On the other hand, I would want to see callables implicitly convert to a value of a compatible function type (possibly through a subtype relationship). Without this capability the syntactic illusion is only half complete. &nbsp;The callable feels like a function when used directly but not when it is assigned to a function type or passed elsewhere - it must be explicitly be wrapped in a closure and the arguments forwarded. &nbsp;First-class callable types are a syntactic sugar feature and as such if they exist they should be usable syntactically in all of the same ways functions are.</div><div><br></div><div>Read-only subscripts are ok as a workaround in absence of first-class callable types (although I think in many ways just using `call` is better). &nbsp;Nevertheless, they are a workaround and can never be more than that because of the fundamental difference in what they model.</div><div><br></div><div>Matthew</div><br><blockquote type="cite"><div><blockquote type="cite"><div><br><blockquote type="cite"><div><div><br class=""></div><div>-Chris</div><div><br class=""></div><br class=""></div></blockquote></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></blockquote></body></html>