[swift-evolution] [RFC] #Self
Matthew Johnson
matthew at anandabits.com
Tue May 10 14:03:20 CDT 2016
> On May 10, 2016, at 1:43 PM, Chris Lattner <clattner at apple.com> wrote:
>
>
>> On May 10, 2016, at 9:03 AM, Matthew Johnson <matthew at anandabits.com <mailto:matthew at anandabits.com>> wrote:
>>
>>>>
>>>> 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?
>
> Either of those would make more sense to me than using # as a distinguisher for dynamic vs static. This isn’t what we use # for.
>
Another suggestion was StaticSelf. Any opinion on that one? Also, do you think we should just drop the # altogether?
If we find a name we can agree on and there is no significant opposition is this a proposal that could make it into Swift 3? I would be willing to write one if that is the case.
-Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160510/f68fc203/attachment.html>
More information about the swift-evolution
mailing list