> On Apr 5, 2016, at 11:41 AM, Russ Bishop <xen...@gmail.com> wrote:
> 
> But if you don’t want subclasses to override it then why are you making it 
> internal/public in the first place?

I'm wan’t talking about overriding it… In my earlier posts I was talking about 
subclasses being able to call a utility function on their superclass and have a 
generic be expanded to the subclass type (whatever it is) by using `#Self`.

So, if the superclass `PropertyOwner ` has something like this (excusing typos 
since this code can’t be compiled right now, obviously =) ...

        static func property<Owner: PropertyOwner, ValueType>(ownerType: 
Owner.Type = #Self.self, name: String, value: ValueType)

then a subclass `Sub` could do:

        static let foozle = property(name: “foozle”, value: Int(3))

and end up with `foozle` being configured with ownerType = Sub.self. If later 
this property is moved to a different class, its ownerType would automatically 
change based on its new scope.

-tim

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to