Following up on the previous discussion, I wanted to refine my suggestion with the one Svein proposed.
Make the prefix Self.
non-required when calling a type member (static
or class
) from an instance member. This can apply to botb methods and properties.
A great example was provided by Jessy. It also shows that the language sort of does this already in other cases.
enum ReallyOutThere {
static func outerStaticMethod() { }
static func reallyOutThereMethod() { }
enum Outer {
static func outerStaticMethod() { }
struct Inner {
static func innerStaticMethod() { }
func instanceMethod() {
innerStaticMethod() // will be possible after proposed change
outerStaticMethod() // already compiles
reallyOutThereMethod() // already compiles
}
}
}
}
This way, the change is completely additive and won't break any existing code.
I believe it should be made to allow better idiomatic code and for better syntax symmetry.