on Wed Apr 06 2016, "Bernd Ohr (jazzbox) via swift-evolution" 
<[email protected]> wrote:

> I am using a typealias for this:
>
> struct MyStruct {
>     private typealias _Self = MyStruct
>
>     static func staticMethod() { print("staticMethod") }
>
>     func instanceMethod() {
>         _Self.staticMethod()
>     }
> }

Yes, you can do that.  It's cumbersome, and you can't use your private
typealias in any public method signatures.

>> > On Apr 5, 2016, at 4:17 PM, Timothy 
>> > Wood<[email protected](mailto:[email protected])>wrote:
>> > 
>> > > On Apr 5, 2016, at 3:04 PM, Joe Groff via 
>> > > swift-evolution<[email protected](mailto:[email protected])>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):
>> Please check to ensure that the changes I just made match your expectations:
>> 
>> https://gist.github.com/erica/c60c7d51809889f3dfd47cdb482d6227
>> 
>> -- E
>> 
>
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

-- 
Dave

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to