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
That's not necessarily connected to SE-0068, since the Self you want here is a dynamic self. @jckarter, do you think this would have to go through evolution?
IMO it fits with the decision notes of SE-0068, which specifically calls out that Self within the body of a class should refer to the dynamic type:
This proposal had light discussion in the community review process, but the core team heavily debated it. It includes two pieces:
1. Expanding the existing support for Self to work in value types, and in the bodies of classes.
2. Replacing the x.dynamicType expression with x.Self, a purely syntactic change that eliminates the “dynamicType” keyword.
The core team has accepted the first half for this proposal. This allows the use of “Self” as shorthand for referring to the containing type (in the case of structs, enums, and final class) or the dynamic type (in the case of non-final classes). Most of the discussion in the core team centered around whether people familiar with the former behavior would be surprised by the (more general) behavior when using it in a class, but they came to agree that this is actually a simple and general model, and a helpful point of consistency.
Additional Detail from JIRA
md5: e3cd47160754677e6ad2288fcf1531fa
Issue Description:
Now that SE-0068 is implemented, it would also be nice to support the use of
Self
in a covariant position of a class method's parameter, e.g:The text was updated successfully, but these errors were encountered: