<div dir="ltr">I've been thinking about naming a bit. I'm worried that "values" / "allValues" won't make sense if this feature eventually goes in the direction of returning type constructors. For enums with associated types, the cases may actually be <b>functions</b> taking the associated type and returning the enum type. (There's an example under "Future directions" in the proposal). Calling these "values" seems strange to me, but calling them "cases" makes sense.<div><div><br></div><div>Even though the "case" <i>keyword</i> is mostly used with enums, I think the actual English <i>word</i> "case" applies pretty well when thinking about any type, not just enums. It refers to a member of the type. T.cases or T.allCases are all the cases of valid instances/members of the type.</div><div><br></div><div>"FiniteType" is technically accurate, but to me it doesn't evoke "this protocol allows you to enumerate the type's values". I'm leaning toward the names that end in -Enumerable.</div><div><br></div><div>Unless someone has a compelling argument otherwise, I may leave the naming as-is in the proposal, and let the core team bikeshed it to their liking :)<br><div class="gmail_extra">
<br><div class="gmail_quote">On Wed, Jan 20, 2016 at 8:45 AM, Denis Nikitenko <span dir="ltr"><<a href="mailto:d.nikitenko@icloud.com" target="_blank">d.nikitenko@icloud.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For the protocol name, I rather like FiniteType (or FiniteValueType), since I find it to be more general and future-proof. ValueEnumerable would also work, though.<br>
<br>
My preference for the static var would be T.values or T.allValues - we want to get all values of the finite type T.<br>
<br>
Definitely a +1 on the overall proposal.<br>
<span><br>
<br>
<br>
>> On Jan 18, 2016, at 11:15 PM, Jacob Bandes-Storch via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
>><br>
>><br>
>> OK, I can see the argument here. I was worried about making this proposal so broad that it wouldn't be seriously considered, but I agree that choosing more general names will open it up to future expansion.<br>
>><br>
>> Here are some more name ideas:<br>
>><br>
>> - CaseEnumerable (in the proposal draft)<br>
>> - T.cases (in the proposal draft)<br>
>> - T.allCases<br>
>> - FiniteType (as you suggested)<br>
>> - FiniteValueType<br>
>> - ValueEnumerable<br>
>> - T.values<br>
>> - T.allValues<br>
>><br>
>> Thoughts? More suggestions? I think I like ValueEnumerable.<br>
>><br>
><br>
</span><div><div>> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
</div></div></blockquote></div><br></div></div></div></div>