[swift-evolution] [Pitch] Moving where Clauses Out Of Parameter Lists

Shawn Erickson shawnce at gmail.com
Wed Apr 6 15:27:06 CDT 2016


I think the where clause should be moved to the end as you outlined an any
constraints beyond simple statements of conformance to a protocol or
superclass should only be allowed in the where clause. If someone desires
to state simple conformance/superclass for a generic parameter they should
be allowed to do so in either location.

On Wed, Apr 6, 2016 at 1:21 PM Pyry Jahkola via swift-evolution <
swift-evolution at swift.org> wrote:

> Joe Groff wrote:
>
>
> It's a judgment call. It's my feeling that in many cases, a generic
> parameter is constrained by at least one important protocol or base class
> that's worth calling out up front, so it's reasonable to allow things like
> 'func foo<C: Collection>(x: C) -> C.Element' without banishing the
> 'Collection' constraint too far from the front of the declaration.
>
>
> Fair enough. I think it would be clearer if all the constraints appeared
> in one standard place (in the `where` clause).
>
> — Pyry
> _______________________________________________
> 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/20160406/da860bff/attachment.html>


More information about the swift-evolution mailing list