[swift-evolution] [Proposal] Allow Static Function Properties to Satisfy Static Function Protocol Requirements

Dave Abrahams dabrahams at apple.com
Mon Jul 11 16:49:22 CDT 2016


on Mon Jul 11 2016, "L. Mihalkovic" <laurent.mihalkovic-AT-gmail.com> wrote:

> Regards
> (From mobile)
>
>> On Jul 11, 2016, at 8:24 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>>> on Sun Jul 10 2016, Jasdev Singh <swift-evolution at swift.org> wrote:
>>> 
>>> Hey Swift Evolution!
>>> 
>>> Drafted up a small proposal that harmonizes the use of static functions and
>>> static function properties in appropriate protocol conformance scenarios:
>>> 
>>> https://github.com/Jasdev/swift-evolution/blob/static-func-static-var/proposals/XXXX-static-func-and-static-var-func-protocol-conformance.md
>>> 
>>> Would love any feedback or edge cases I may have missed!
>> 
>> Hi Jasdev,
>> 
>> I wanted this once, before Swift 1 was released.  Its lack was easy to
>> work around and I have never wanted it since, so... I'm afraid I don't
>> think it is worth complicating the language for.  Your proposal shows
>> how the feature *can be used*, but doesn't make a compelling case that it
>> *will be very useful*.  That's what would be needed to convince me.
>
> Have you looked into the design patterns it opens the door to, or how
> it is used in languages where it is present? IME it has to do with
> higher degrees of abstractions or more dynamic behaviors. 

Right, the latter.

> Granted it is also not the only way to achieve that.

Right.  It's also not the most efficient way in most cases.  It's better
to store one class instance than a bunch of closures.

> TypeScript might interest you if you have not yet looked into it
> closely.

Thanks, but the onus is on the proposer to make a case for his feature.
I'm trying to explain how to do that.

-- 
Dave


More information about the swift-evolution mailing list