<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 3:16 PM, Jens Persson <<a href="mailto:jens@bitcycle.com" class="">jens@bitcycle.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Here are the four you asked me to report:<div class=""><br class=""></div><div class=""><div class=""><a href="https://bugs.swift.org/browse/SR-5127" class="">https://bugs.swift.org/browse/SR-5127</a></div><div class="">Single-tuple and multiple-argument function types should not be considered equal</div><div class=""> </div><div class=""><a href="https://bugs.swift.org/browse/SR-5128" class="">https://bugs.swift.org/browse/SR-5128</a></div><div class="">Don't allow swapping a single-tuple function with a multiple-argument function</div><div class=""><br class=""></div><div class=""><a href="https://bugs.swift.org/browse/SR-5129" class="">https://bugs.swift.org/browse/SR-5129</a></div><div class="">Don't treat func signatures as being the same when they are in fact different</div><div class=""><br class=""></div><div class=""><a href="https://bugs.swift.org/browse/SR-5130" class="">https://bugs.swift.org/browse/SR-5130</a></div><div class="">Single-tuple and multiple-argument function types should be treated as different types</div></div></div></div></blockquote><div><br class=""></div>Thanks!</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><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jun 6, 2017 at 8:17 PM, Mark Lacey via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br class="">
> On Jun 6, 2017, at 11:09 AM, Vladimir.S <<a href="mailto:svabox@gmail.com" class="">svabox@gmail.com</a>> wrote:<br class="">
><br class="">
> On 06.06.2017 19:41, Mark Lacey wrote:<br class="">
>>> On Jun 6, 2017, at 4:00 AM, Vladimir.S <<a href="mailto:svabox@gmail.com" class="">svabox@gmail.com</a> <mailto:<a href="mailto:svabox@gmail.com" class="">svabox@gmail.com</a>>> wrote:<br class="">
>>><br class="">
>>> Mark, could you please also comment this inconsistencies / bugs :<br class="">
>>> (swift-4.0-DEVELOPMENT-<wbr class="">SNAPSHOT-2017-06-01-a-osx)<br class="">
>>><br class="">
>>> func fooParam(_ x: Int, _ y: Int){}<br class="">
>>> func fooTuple(_ x: (Int, Int)) {}<br class="">
>>><br class="">
>>> print("type of fooParam is", type(of:fooParam))<br class="">
>>> // result: type of fooParam is (Int, Int) -> ()<br class="">
>>><br class="">
>>> print("type of fooTuple is", type(of:fooTuple))<br class="">
>>> // result: type of fooTuple is (Int, Int) -> ()<br class="">
>>><br class="">
>>> print("type of fooTuple as (_:(Int,Int))->Void is", type(of: fooTuple as (_:(Int,Int))->()))<br class="">
>>> // result: type of fooTuple as (_:(Int,Int))->() is (Int, Int) -> ()<br class="">
>>><br class="">
>>><br class="">
>>> print("type of fooParam == type of fooTuple ?", type(of: fooParam) == type(of: fooTuple))<br class="">
>>> // result: true<br class="">
>>><br class="">
>>> if fooParam is (_: (Int,Int))->() { print("fooParam is (_: (Int,Int))->()") }<br class="">
>>> // result: fooParam is (_: (Int,Int))->()<br class="">
>>><br class="">
>>> if fooTuple is (Int,Int)->() { print("fooTuple is (Int,Int)->()") }<br class="">
>>> // result: fooTuple is (Int,Int)->()<br class="">
>>><br class="">
>>> var closureParam = { (x: Int, y: Int) in }<br class="">
>>> var closureTuple = { (x: (Int, Int)) in }<br class="">
>>><br class="">
>>> print("type of closureParam is", type(of:closureParam))<br class="">
>>> // result: type of closureParam is (Int, Int) -> ()<br class="">
>>><br class="">
>>> print("type of closureTuple is", type(of:closureTuple))<br class="">
>>> // result: type of closureTuple is (Int, Int) -> ()<br class="">
>>><br class="">
>>> if closureParam is (_: (Int,Int))->() { print("closureParam is (_: (Int,Int))->()") }<br class="">
>>> // result: closureParam is (_: (Int,Int))->()<br class="">
>>><br class="">
>>> if closureTuple is (Int,Int)->() { print("closureTuple is (Int,Int)->()") }<br class="">
>>> // result: closureTuple is (Int,Int)->()<br class="">
>> Can you open two reports at <a href="http://bugs.swift.org/" rel="noreferrer" target="_blank" class="">bugs.swift.org</a> <<a href="http://bugs.swift.org/" rel="noreferrer" target="_blank" class="">http://bugs.swift.org</a>>, one for the ‘is’ issue, and one for type(of:)?<br class="">
>> These (along with the issue with function declarations that Jens mentioned) are all similar issues, but each is in a different part of the compiler.<br class="">
><br class="">
> Here they are:<br class="">
> <a href="https://bugs.swift.org/browse/SR-5114" rel="noreferrer" target="_blank" class="">https://bugs.swift.org/browse/<wbr class="">SR-5114</a> (typeof)<br class="">
> <a href="https://bugs.swift.org/browse/SR-5112" rel="noreferrer" target="_blank" class="">https://bugs.swift.org/browse/<wbr class="">SR-5112</a> (is)<br class="">
<br class="">
</div></div>Thanks!<br class="">
<br class="">
Mark<br class="">
<div class="HOEnZb"><div class="h5"><br class="">
><br class="">
>> Mark<br class="">
>>><br class="">
>>> Thank you.<br class="">
>>> Vladimir.<br class="">
>>><br class="">
>>> On 06.06.2017 11:43, Mark Lacey via swift-evolution wrote:<br 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> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>>> wrote:<br class="">
>>>>><br 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:<br class="">
>>>>><br class="">
>>>>> func foo(fun: (Int, Int) -> ()) { print("was given a function of type: (Int, Int) -> ()") }<br class="">
>>>>> func foo(fun: ((Int, Int)) -> ()) { print("was given a function of type: ((Int, Int)) -> ()") }<br class="">
>>>> 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.<br class="">
>>>>> // This will result in error: invalid redeclaration of 'foo(fun:)'<br class="">
>>>>><br class="">
>>>>> I would expect this to compile, and I can't understand how this has anything to do with the reflective type system.<br class="">
>>>>><br class="">
>>>>><br class="">
>>>>> Here is another example:<br class="">
>>>>><br class="">
>>>>> func add(_ a: Int, _ b: Int) -> Int { return a + b }<br class="">
>>>>> let a: (Int, Int) -> Int = add<br class="">
>>>>> let b: ((Int, Int)) -> Int = add // This is OK, unexpectedly<br class="">
>>>> I didn’t have a chance to look at this yet. I suspect this is related to the swap example that you gave previously.<br class="">
>>>>> I would not expect it to compile since the add func does not have the type ((Int, Int)) -> Int.<br class="">
>>>>> I don't think that is a dynamic cast, is it?<br class="">
>>>> 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.<br class="">
>>>> Mark<br class="">
>>>>><br class="">
>>>>> /Jens<br class="">
>>>>><br class="">
>>>>><br class="">
>>>>><br class="">
>>>>><br class="">
>>>>> On Tue, Jun 6, 2017 at 2:45 AM, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a> <mailto:<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> <mailto:<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>>> wrote:<br class="">
>>>>><br class="">
>>>>>> On Jun 5, 2017, at 12:08 AM, Jens Persson via swift-evolution<br class="">
>>>>>> <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>>> wrote:<br class="">
>>>>>> So the bug in the reflective type system needs to be fixed before SE-0110 can<br class="">
>>>>>> actually be implemented (so that the statements in its title and text are true<br class="">
>>>>>> when compared to the actual behavior of the current Swift 4 compiler),<br class="">
>>>>><br class="">
>>>>> Gaps in the reflective type system are bugs, but they are not showstopper<br class="">
>>>>> bugs. We do not even expose any way to query the reflective system today; it<br class="">
>>>>> basically only affects type equality and dynamic casts that programmers are<br class="">
>>>>> very unlikely to use. The changes in call type-checking are vastly more<br class="">
>>>>> important, are implemented (modulo bugs, of course), and by themselves warrant<br class="">
>>>>> calling SE-0110 implemented.<br class="">
>>>>><br class="">
>>>>> John.<br class="">
>>>>><br class="">
>>>>>><br class="">
>>>>>> And yet:<br class="">
>>>>>><br class="">
>>>>>> 1. The status of SE-0110 is "Implemented"<br class="">
>>>>>><br class="">
>>>>>> 2. These statuses of the following issues are "resolved":<br class="">
>>>>>> SR-2008: Distinguish between single-tuple and multiple-argument function types<br class="">
>>>>>> SR-2216: Confusing behavior related to closure types and tuples<br class="">
>>>>>> SR-296: Fix inconsistencies related to tuples, arg/param lists, type<br class="">
>>>>>> params, typealiases<br class="">
>>>>>><br class="">
>>>>>> Why?<br class="">
>>>>>><br class="">
>>>>>> /Jens<br class="">
>>>>>><br class="">
>>>>>><br class="">
>>>>>> On Sun, Jun 4, 2017 at 5:49 PM, Ben Rimmington <<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a> <mailto:<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a>><br class="">
>>>>>> <mailto:<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a>>> wrote:<br class="">
>>>>>><br class="">
>>>>>> I assumed that Swift 3 mode would be the default, so that existing<br class="">
>>>>>> `#!/usr/bin/swift` scripts continue to work.<br class="">
>>>>>><br class="">
>>>>>> -- Ben<br class="">
>>>>>><br class="">
>>>>>> > On 3 Jun 2017, at 23:47, Jens Persson <<a href="mailto:jens@bitcycle.com" class="">jens@bitcycle.com</a> <mailto:<a href="mailto:jens@bitcycle.com" class="">jens@bitcycle.com</a>> <mailto:<a href="mailto:jens@bitcycle.com" 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" class="">me@benrimmington.com</a> <mailto:<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a>> <mailto:<a href="mailto:me@benrimmington.com" 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-<wbr class="">compatibility</a><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-<wbr class="">compatibility</a>>><br class="">
>>>>>> >><br class="">
>>>>>> >> -- Ben<br class="">
>>>>>><br class="">
>>>>>><br class="">
>>>>>> ______________________________<wbr class="">_________________<br class="">
>>>>>> swift-evolution mailing list<br class="">
>>>>>> <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>><br class="">
>>>>>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
>>>>>> <<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a>><br class="">
>>>>><br class="">
>>>>><br class="">
>>>>> ______________________________<wbr class="">_________________<br class="">
>>>>> swift-evolution mailing list<br class="">
>>>>> <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>><br class="">
>>>>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
>>>> ______________________________<wbr class="">_________________<br class="">
>>>> swift-evolution mailing list<br class="">
>>>> <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.<wbr class="">org</a>><br class="">
>>>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class="">
______________________________<wbr class="">_________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>