[swift-evolution] Default Generic Arguments

Matthew Johnson matthew at anandabits.com
Mon Jan 23 18:30:49 CST 2017

This proposal looks good to me.  I have been looking forward to more flexible generic arguments for a while.

I agree with previous commenters who prefer the option to leave off the angle brackets when all parameters have defaults.

The proposal specifically mentions that the syntax is inspired by that of function arguments.  This is good, but I wonder if maybe we should draw further inspiration from function arguments and also add parameter labels for generic arguments.  Both feel like low hanging fruit in the generics area (correct me if I’m wrong about that) and it would be great to see both enhancements make it into Swift 4.

> On Jan 23, 2017, at 9:55 AM, Srđan Rašić via swift-evolution <swift-evolution at swift.org> wrote:
> Hi Everyone,
> I've opened a PR (https://github.com/apple/swift-evolution/pull/591 <https://github.com/apple/swift-evolution/pull/591>) proposing default generic arguments which I think would be nice addition to the language. They are also mentioned in "Generic manifesto". 
> The proposal is focusing around generic types. Generic functions are not coved by the proposal and I don't think that we need default generic arguments in generic functions as all the types are always part of the function signature so the compiler can always infer them. One corner case might be if using default argument values in which case support for default generic arguments in functions might be useful.
> It would be great to hear your opinions and suggestions so I can refine the proposal.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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

More information about the swift-evolution mailing list