Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-25 Thread Vladimir.S via swift-evolution
Sorry, if was discussed earlier, tried to find in conversations in this thread but didn't find: Could someone please briefly describe why "community is in agreement" - "The "allValues" behavior should be provided by conformance to some protocol" ? I mean, what is purpose of the protocol? What

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-23 Thread Howard Lovatt via swift-evolution
If you wrote: enum Ex { case one, two, three } And the compiler translated that into the equivalent of: - struct Ex : OptionSetType { - let rawValue: UInt - init(rawValue: UInt

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-23 Thread John McCall via swift-evolution
> On Apr 22, 2016, at 11:48 PM, Jacob Bandes-Storch wrote: > On Fri, Apr 22, 2016 at 11:34 PM, John McCall > wrote: >> On Apr 22, 2016, at 11:11 PM, Jacob Bandes-Storch > >

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-23 Thread Jacob Bandes-Storch via swift-evolution
On Fri, Apr 22, 2016 at 11:34 PM, John McCall wrote: > On Apr 22, 2016, at 11:11 PM, Jacob Bandes-Storch > wrote: > On Fri, Apr 22, 2016 at 10:50 PM, John McCall wrote: > >> >> I have not been following this discussion, but I would be

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-23 Thread John McCall via swift-evolution
> On Apr 22, 2016, at 11:11 PM, Jacob Bandes-Storch wrote: > On Fri, Apr 22, 2016 at 10:50 PM, John McCall > wrote: > > I have not been following this discussion, but I would be extremely antsy > about guaranteeing any

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-22 Thread John McCall via swift-evolution
> On Apr 22, 2016, at 10:18 PM, Jacob Bandes-Storch wrote: > On Sat, Apr 16, 2016 at 5:20 AM, plx via swift-evolution > > wrote: > > > My 2c is that if this is to go in the standard library, it should be done >

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-22 Thread Jacob Bandes-Storch via swift-evolution
On Sat, Apr 16, 2016 at 5:20 AM, plx via swift-evolution < swift-evolution@swift.org> wrote: > > > My 2c is that if this is to go in the standard library, it should be done > “right”, which would be more like this version of it: > > protocol ValueEnumerable { > associatedtype ValueCollection :

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-22 Thread Jacob Bandes-Storch via swift-evolution
On Sat, Apr 16, 2016 at 3:56 AM, Brent Royal-Gordon wrote: > (I favor "Values" because "Value" in the singular implies to me that you > can take a single value and enumerate it somehow, which is not what I have > in mind.) > OK, after reading it this way long enough, I'm

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-18 Thread Vladimir.S via swift-evolution
On 16.04.2016 5:00, Jacob Bandes-Storch via swift-evolution wrote: I believe the community is in agreement about the following: • The "allValues" behavior should be provided by conformance to some protocol, named ValueEnumerable or ValuesEnumerable or similar. • The compiler should

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-16 Thread plx via swift-evolution
> On Apr 15, 2016, at 9:00 PM, Jacob Bandes-Storch via swift-evolution > wrote: > > This discussion is about a proposal for API to enumerate/count all possible > values of a type, particularly enums. The goal is to address potential issues > with an old proposal,

Re: [swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-15 Thread Brent Royal-Gordon via swift-evolution
> I would suggest that ValuesEnumerable should expose allValues and the type of > allValues should be a custom OptionSet implementation that iterates in > declaration order. That would make sense if OptionSet were a generic type which took any integer-ish RawRepresentable (which I've advocated

[swift-evolution] ValueEnumerable protocol with derived implementation for enums

2016-04-15 Thread Jacob Bandes-Storch via swift-evolution
This discussion is about a proposal for API to enumerate/count all possible values of a type, particularly enums. The goal is to address potential issues with an old proposal, so it can go up for review soon. Core Team / Standard Library Team feedback would be particularly welcome here, because