[swift-evolution] Multiple protocols variable - automatic class-type inference
Jakub Skotnicki
jakubskot at gmail.com
Sun Jul 3 17:47:53 CDT 2016
Hi,
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 swift-evolution <https://github.com/apple/swift-evolution>
site, also these in the rejected section, that is why I am mailing it to
discuss.
What is it about? (picture below - code with explanations):
[image: Obraz w treści 1]
Conclusion:
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.
I believe it has no impact on existing code. It will simply start to work.
Please let me know what you think about it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160704/4d0ba461/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swift.png
Type: image/png
Size: 227332 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160704/4d0ba461/attachment-0001.png>
More information about the swift-evolution
mailing list