[swift-evolution] [RFC] #Self

Matthew Johnson matthew at anandabits.com
Tue May 10 11:07:57 CDT 2016



Sent from my iPad

> On May 10, 2016, at 11:05 AM, Austin Zheng <austinzheng at gmail.com> wrote:
> 
> I'm partial to #This or #ThisType.
> 

Can you elaborate on why?  This feels out of place to me in the Swift and Objective-C world.

> /bikeshed
> 
> Austin
> 
>> On May 10, 2016, at 9:03 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>> 
>> Sent from my iPad
>> 
>>>> On May 10, 2016, at 10:56 AM, Chris Lattner <clattner at apple.com> wrote:
>>>> 
>>>> 
>>>> On May 10, 2016, at 7:50 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
>>>> 
>>>> As a compile-time substitution, it could be used in any and all of the examples in your bullet list as a literal text replacement..
>>>> 
>>>> Quick rundown:
>>>> 
>>>> struct A {
>>>>  ...#Self... // #Self is substituted by A
>>>> }
>>>> 
>>>> class B {
>>>>   ...#Self... // Self is substituted by B
>>>> }
>>>> 
>>>> class C {
>>>>  ... #Self... // Self is substituted by C, which is the defining type at compile time
>>>> }
>>> 
>>> I think it would be surprising if #Self produced the name of the enclosing static type: Self produces the dynamic type, and we’d want to preserve consistency if it were named #Self.
>> 
>> That's a fair critique.  Having a more distinct name will make it clear that the behavior is completely unrelated to Self.
>> 
>> How about #Type or #StaticType?
>> 
>>> 
>>> -Chris
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160510/a1ab258d/attachment.html>


More information about the swift-evolution mailing list