Are there reasons that prevent using `Self` as a synonym for an instance's type
name?
Consider:
struct MyStruct {
static func foo() { print("foo") }
func bar() {
MyStruct.foo() // works
self.dynamicType.foo() // works
Self.foo() // error
}
}
Obviously, you can always name a type directly or use `self.dynamicType` but
neither solution does any favors for readability. Both approaches obscure
intent,
especially as type names grow large: `MyExtremelyLargeTypeName.staticMember`,
for example. Plus, as Kevin B pointed out to me,
`self.dynamicType.classMember`
and `TypeName.classMember` may not be synonyms in class types with non-final
members.
I'd like to see `Self.staticMember` introduced as a synonym for
`TypeName.staticMember`.
Thoughts?
-- E
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution