[swift-evolution] [Review] SE-0068: Expanding Swift Self to class members and value types

Erica Sadun erica at ericasadun.com
Wed Apr 20 15:27:56 CDT 2016

> On Apr 20, 2016, at 12:37 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> on Wed Apr 20 2016, Chris Lattner <swift-evolution at swift.org> wrote:
>> Hello Swift community,
>> The review of "SE-0068: Expanding Swift Self to class members and value types"
>> begins now and runs through April 25. The proposal is available here:
>> https://github.com/apple/swift-evolution/blob/master/proposals/0068-universal-self.md
> Caveat: somewhat scattered response, probably after insufficient
> review; apply salt liberally.
> This looks like a good idea overall to me, but I think it may leave
> important uses for Self on the floor.  For example, I still want to
> write this:
>  struct SomeType {
>    func f(x: Self) {}
>  }
> Does the proposal make that work in some way that I've overlooked?  
> IMO it's a shame that you can't take a protocol body, dump it into your
> type's body, and fill in the implementations to satisfy a conformance
> without finding all the instances of “Self” and replacing them with your
> type's name, and it would be sad if this proposal didn't address that
> somehow.  In general, I'm concerned that we may be making “Self” mean
> two very different things in different contexts: IIUC one is a type
> that's fully-resolved at compile time, and the other one is a value that
> holds a metatype.  If there were less of a wall between the two
> uses/contexts, that would make the proposal more palatable to me.

It kind of did address this until late last night. I was worried that proposing #Self and Self at the
same time would be divisive. The point of #Self would be a compile-time replacement of the name
of the defining type, vs the run-time evaluation of Self. Trying to propose two things at once 
seemed like a difficult sell.

If there's sufficient support for doing so, I can add it back in as a revision to the proposal if
the core team requests it.

-- E

More information about the swift-evolution mailing list