There's something I find very confusing with this proposal, and it's how Self
is already used in protocol definitions to represent the STATIC type of the
type that conforms to the protocol. I think people will be potentially very
confused by how Self represents different types in different contexts:
protocol Copyable {
func copy() -> Self
}
class Animal : Copyable {
init() {}
func copy() -> Animal {
return Self.init()
}
}
class Cat : Animal {}
In the previous sample, wouldn't it be confusing to people if Self in the
protocol means Animal in the Animal type, but Self in the Animal type may mean
Cat?
Sent from my iPad
> On 06 Apr 2016, at 18:51, Erica Sadun via swift-evolution
> <[email protected]> wrote:
>
>
>>> On Apr 5, 2016, at 4:04 PM, Joe Groff <[email protected]> wrote:
>>>
>>>
>>> On Apr 5, 2016, at 3:02 PM, Erica Sadun <[email protected]> wrote:
>>>
>>> As the discussion seems to be quieting down, I've tried to summarize the
>>> on-list discussion and distill it into a preliminary proposal draft. Please
>>> let me know if this covers what you think it should or if I've entirely
>>> missed the mark. (It wouldn't be the first time.)
>>>
>>> Regards, -- Erica
>
>
> Pull Request 248: https://github.com/apple/swift-evolution/pull/248
>
> Within a class scope, Self means "the dynamic class of self". This proposal
> extends that courtesy to value types, where dynamic Self will match a
> construct's static type, and to the bodies of class members, where it may
> not. It also introduces a static variation, #Self that expands to static type
> of the code it appears within.
>
> This proposal was discussed on the Swift Evolution list in the [Pitch] Adding
> a Self type name shortcut for static member access thread.
>
> Thanks, -- E
>
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution