[swift-evolution] [Pitch] Moving where Clauses Out Of Parameter Lists
erica at ericasadun.com
Wed Apr 6 15:28:30 CDT 2016
On Apr 6, 2016, at 2:03 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> On Apr 6, 2016, at 12:52 PM, Pyry Jahkola <pyry.jahkola at iki.fi> wrote:
>> Just from your experience on this topic, is there any reason not to also move the primary constraints into the trailing `where` clause?
> 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.
From a reading point of view, it's always better to declare tokens before using them. This groups them with the parameters (and the parameters in turn may use the tokens), so the scope-specific vocabulary is all laid out in front.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution