[swift-evolution] [Pitch] Make the formal type of 'self' consistent in class methods

Slava Pestov spestov at apple.com
Thu Jun 23 15:48:20 CDT 2016

> On Jun 23, 2016, at 1:46 PM, Andrew Trick <atrick at apple.com> wrote:
>> On Jun 23, 2016, at 12:53 PM, Slava Pestov via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> The proposal is to change the type of self to always be Self, which can be thought of as a special generic type parameter bound to the dynamic type of the instance.
> We’re currently specializing functions that take `self` as an argument. I don’t think that will be possible after your proposed change.
> - Andy

I’m not sure what that means. Do you currently punt on certain optimizations if a method returns ‘Self’?

It should be possible to keep the reified type information around, by passing in a metatype or something for example. Can you give a concrete code snippet demonstrating the optimization and how this change would inhibit it?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/8c1a1c7f/attachment.html>

More information about the swift-evolution mailing list