> On Apr 5, 2016, at 3:04 PM, Joe Groff via swift-evolution > <swift-evolution@swift.org> wrote: > > What you're describing should be spelled `Self`, IMO. I think Tim intended > `#Self` to mean the *static* type the code is declared inside (which is the > same as Self unless you're in a class).
Yes, that is what I was aiming for. `#Self` would be a pretty much textual replacement just like #file, etc. That is, I could imaging it being used in a bunch of cases (not useful here, but just intending to enumerate the possible uses I see): class Foo { static let myClass: #Self.Type = #Self.self static let anInstance: #Self = #Self() static let defaultState = … var state = #Self.defaultState } The extra bit I was suggesting for allowing passing it in as a default argument like #file is for assert/precondition would be useful to me too: func globalFunc<SomeType: SomeProtocol>(callerType: SomeType.Type = #Self.self, …) which would only be callable inside a class/struct/enum context that conformed to SomeProtocol (unless you explicitly passed a callerType that met the requirements, of course). I’ve no idea if this latter bit is hard enough or controversial enough to be its own proposal =) -tim
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution