[swift-evolution] [Pitch] Adding a Self type name shortcut for static member access
Timothy Wood
tjw at me.com
Mon Apr 4 15:55:05 CDT 2016
> On Apr 4, 2016, at 1:39 PM, Howard Lovatt <howard.lovatt at gmail.com> wrote:
>
> If the `.StaticMember` (no type name) notation discussed already at least twice, in the context of expanding the `.EnumCase` syntax, was accepted, this would eleviate the problem.
I was thinking about the syntax a bit further and it seems like the capability that would be added is like #file, in that it does some compile-time textual replacement. So, perhaps #Self would work?
Also, along these lines, I would find use for call-site interpolation like #file has. I could then do a free function version of my property() call that was something like:
func property(ownerType: PropertyOwner.Type = #Self, ...) { }
which would only be callable from w/in things conforming to or subclassing PropertyOwner.
-tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160404/49029131/attachment.html>
More information about the swift-evolution
mailing list