Integer generic parameters

Given that these generic parameters are values, not types, should we not establish the convention of writing them in lowerCamelCase per the Swift API Guidelines? The pitch, both here and on GitHub, writes them in UpperCamelCase (e.g. N and Shape instead of n and shape).

I think a lowerCamelCase convention for value generic parameters would be better not only for consistency with the existing Swift conventions, but also because it's useful to immediately know, in any situation, whether a symbol is a value or a type. If the conventions established in the pitch stand, one may do a double take after seeing Length be used as a value — "Wait a minute, that's a type, shouldn't there be a .self here?" — while hundreds of lines deep into the source code of a Vector<let Length: Int> type.

And, alongside the requirement of writing let before each value generic parameter, writing them in lowerCamelCase and the type parameters in UpperCamelCase would further clarify which are which. Adapting an example from the pitch, take struct TwoValueParams<T: Foo, let n: Bar, S: Baz, let m: Qux>. Alongside the lets, the lowercasing visually explains that n and m are not like T and S.

Most of all, it would just be a little strange for values in Swift (including constants) to always be lowerCamelCase except, from now on, in one specific situation.

</bikeshedding>

26 Likes