<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 Jun 6, 2017, at 12:08 AM, Jens Persson via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">IMHO There seems to be a lot of bugs and inconsistencies left in more than just the reflective type system, for example the following won't compile although the two foo funcs clearly take different types as argument:<div class=""><br class=""></div><div class=""><div class="">func foo(fun: (Int, Int) -> ()) { print("was given a function of type: (Int, Int) -> ()") }</div><div class="">func foo(fun: ((Int, Int)) -> ()) { print("was given a function of type: ((Int, Int)) -> ()") }</div></div></div></div></blockquote><div><br class=""></div><div>I took a look at this. When determining if we have conflicting declarations, we compute an interface type and this computation is stripping the parens around the tuple in the second example, resulting in these two signatures appearing to be the same, despite the fact that the types of the arguments to the two functions are different.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">// This will result in error: invalid redeclaration of 'foo(fun:)'</div></div><div class=""><br class=""></div><div class="">I would expect this to compile, and I can't understand how this has anything to do with the reflective type system.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Here is another example:</div><div class=""><div class=""><br class=""></div><div class=""><div class="">func add(_ a: Int, _ b: Int) -> Int { return a + b }</div><div class="">let a: (Int, Int) -> Int = add</div><div class="">let b: ((Int, Int)) -> Int = add // This is OK, unexpectedly</div></div></div></div></div></blockquote><div><br class=""></div>I didn’t have a chance to look at this yet. I suspect this is related to the swap example that you gave previously.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">I would not expect it to compile since the add func does not have the type ((Int, Int)) -> Int.</div><div class="">I don't think that is a dynamic cast, is it?<br class=""></div></div></div></blockquote><div><br class=""></div><div>Would you mind opening bugs for all four issues - the two mentioned above and the two from the previous e-mail (with type(of:) and swap examples)? Despite the fact that some of these might have different underlying causes it would be useful to have separate bugs and if they turn out to be the same issue we can dup as appropriate.</div></div><div><br class=""></div><div>Mark</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">/Jens</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jun 6, 2017 at 2:45 AM, John McCall <span dir="ltr" class=""><<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jun 5, 2017, at 12:08 AM, Jens Persson via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div dir="ltr" class="">So the bug in the reflective type system needs to be fixed before SE-0110 can actually be implemented (so that the statements in its title and text are true when compared to the actual behavior of the current Swift 4 compiler), </div></div></blockquote><div class=""><br class=""></div></span>Gaps in the reflective type system are bugs, but they are not showstopper bugs. We do not even expose any way to query the reflective system today; it basically only affects type equality and dynamic casts that programmers are very unlikely to use. The changes in call type-checking are vastly more important, are implemented (modulo bugs, of course), and by themselves warrant calling SE-0110 implemented.</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">John.</div><div class=""><br class=""></div></font></span><div class=""><blockquote type="cite" class=""><div class=""><span class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">And yet:</div><div class=""><br class=""></div><div class="">1. The status of SE-0110 is "Implemented"</div><div class=""><br class=""></div><div class="">2. These statuses of the following issues are "resolved":</div><div class=""> SR-2008: Distinguish between single-tuple and multiple-argument function types<br class=""></div><div class=""> SR-2216: Confusing behavior related to closure types and tuples</div><div class=""> SR-296: Fix inconsistencies related to tuples, arg/param lists, type params, typealiases</div><div class=""><br class=""></div><div class="">Why?</div><div class=""><br class=""></div><div class="">/Jens</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Jun 4, 2017 at 5:49 PM, Ben Rimmington <span dir="ltr" class=""><<a href="mailto:me@benrimmington.com" target="_blank" class="">me@benrimmington.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I assumed that Swift 3 mode would be the default, so that existing `#!/usr/bin/swift` scripts continue to work.<br class="">
<span class="m_309397005148687700HOEnZb"><font color="#888888" class=""><br class="">
-- Ben<br class="">
</font></span><div class="m_309397005148687700HOEnZb"><div class="m_309397005148687700h5"><br class="">
> On 3 Jun 2017, at 23:47, Jens Persson <<a href="mailto:jens@bitcycle.com" target="_blank" class="">jens@bitcycle.com</a>> wrote:<br class="">
><br class="">
> Yes of course, try my demonstration code yourself.<br class="">
> (In the current dev snapshots, -swift-version 4 is the default and -swift-version 3 is what you need to set if you want 3 compability)<br class="">
><br class="">
>> On Sun, Jun 4, 2017 at 12:37 AM, Ben Rimmington <<a href="mailto:me@benrimmington.com" target="_blank" class="">me@benrimmington.com</a>> wrote:<br class="">
>><br class="">
>> Are you using the Swift 4 language mode?<br class="">
>><br class="">
>> <<a href="https://swift.org/blog/swift-4-0-release-process/#source-compatibility" rel="noreferrer" target="_blank" class="">https://swift.org/blog/swift-<wbr class="">4-0-release-process/#source-co<wbr class="">mpatibility</a>><br class="">
>><br class="">
>> -- Ben<br class="">
</div></div></blockquote></div><br class=""></div></span><span class="">
______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class=""></span></div></blockquote></div><br class=""></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>