You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-117 Calling default implementation of protocols
Issue Description:
Sometimes, a protocol provides an overload of a super-protocol's method. Since it's an extension method, which one you get depends on what kind of reference you have to the receiver.
For example, the split methods used to be requirements on Sequence. Now they have moved to be extensions. These methods also exist on Collection. If you have a collection, you always get Collection.split when you call split. The only way to call the Sequence version is to wrap the object within AnySequence. You can also add an extension method to Sequence with a custom name to call Sequence.split.
But the above solution is not scaleable. You have to keep coming up with unique names and hope someone doesn't add an overload to the refined protocol. I think C++ has ways for an object to call the base type version of an overloaded method, and we should similarly add a general way to do this in Swift.
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: deebcaed7e6c447d14091d7689ac1588
relates to:
Issue Description:
Sometimes, a protocol provides an overload of a super-protocol's method. Since it's an extension method, which one you get depends on what kind of reference you have to the receiver.
For example, the
split
methods used to be requirements onSequence
. Now they have moved to be extensions. These methods also exist onCollection
. If you have a collection, you always getCollection.split
when you callsplit
. The only way to call theSequence
version is to wrap the object withinAnySequence
. You can also add an extension method toSequence
with a custom name to callSequence.split
.But the above solution is not scaleable. You have to keep coming up with unique names and hope someone doesn't add an overload to the refined protocol. I think C++ has ways for an object to call the base type version of an overloaded method, and we should similarly add a general way to do this in Swift.
The text was updated successfully, but these errors were encountered: