[swift-evolution] [swift-evolution-announce] [Review] SE-0068: Expanding Swift Self to class members and value types

Brent Royal-Gordon brent at architechies.com
Sun Apr 24 20:57:50 CDT 2016


> 	https://github.com/apple/swift-evolution/blob/master/proposals/0068-universal-self.md

I'm not totally clear what's being proposed here.

Is this valid?

	class Foo {
		static func bar() { … }
		func baz(other: Foo) {
			Self.bar()
		}
	}

Is this valid?

	struct Foo {		// note: not class
		static func bar() { … }
		func baz(other: Foo) {
			Self.bar()
		}
	}

Is this valid?

	class Foo {
		static func bar() { … }
		func baz(other: Foo) {
			other.Self.bar()	// note: not self
		}
	}

Is this valid?

	struct Foo {		// note: not class
		static func bar() { … }
		func baz(other: Foo) {
			other.Self.bar()	// note: not self
		}
	}

Can a class have a variable (inside a method) of type Self? A return value? A parameter? A property?

Can a value type have a variable (inside a method) of type Self? A return value? A parameter? A property?

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list