<div dir="ltr"><div><div>Thanks for replies, here is the use of proposed mutating function - still does not work.<br><br></div>Moreover it produces weird error in 1.1A - I think it is because of mutating keyword which cannot be used in class-protocols, but still testVar is a class instance, so it should not matter - but if I understand you correctly Jordan, it works in Swift 3, so no worries here?<br><img style="margin-right: 0px;" src="cid:ii_iqshrpb80_155ffb97a34c95b7"><br><br></div><div>Below - I understand this is a "let" constant, but still it should be inferred that testVar4 and testVar5 are class instances because they implement ClassProtocol and AnyObject protocol accordingly.<br></div><div>The same goes for function parameters, and now it even crashes the source editor when uncommenting the last line.<br></div><div><img style="margin-right: 0px;" src="cid:ii_iqshtomc1_155ffbae49f6dc06"><br><br></div><div>So is this resolved in Swift 3?<br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-05 19:54 GMT+02:00 Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>The case with testVar4 and testVar5 is not exactly a bug—the default implementation of a mutating protocol requirement can reassign 'self' even if the dynamic type turns out to be a class. (I'm not sure <i>that's</i> a good feature, but it is the current behavior of Swift 3.) I agree that we should resolve the contradiction at the end somehow, though.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Jordan</div></font></span><div><div class="h5"><div><br></div><br><div><blockquote type="cite"><div>On Jul 5, 2016, at 8:39, Charlie Monroe via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div style="word-wrap:break-word"><div>These feel like bugs in the compiler. I'd suggest filing a bug report at <a href="http://bugs.swift.org/" target="_blank">http://bugs.swift.org</a> if others don't think there is more to it...</div><br><div><blockquote type="cite"><div>On Jul 4, 2016, at 12:47 AM, Jakub Skotnicki via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="ltr"><div><div>Hi,<br><br></div>I would like to make a proposal for automatic class-type inference for a variable which conforms to multiple protocols. I have not seen any similar proposals on <a href="https://github.com/apple/swift-evolution" target="_blank">swift-evolution</a> site, also these in the rejected section, that is why I am mailing it to discuss. <br><br></div><div>What is it about? (picture below - code with explanations):<br><br><span><swift.png></span><br><br></div><div>Conclusion:<br>Multiple protocols constant variable should have its properties mutable if at least one of the protocols is a class-protocol. Firstly, this solves a problem of changing this variable to mutable (with var keyword), which can simply be undesirable, and currently leads to a paradox warning if done on a method parameter. Secondly, it solves a problem of changing specified protocols to class-protocols in order to modify any properties or use mutating function on such variables, which could be an unwanted constrain or it is simply impossible in cases where specified protocols iare also implemented by non-class types.<br><br></div><div>I believe it has no impact on existing code. It will simply start to work.<br><br></div><div>Please let me know what you think about it.<br></div></div>
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div></div></blockquote></div><br></div>