Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-12-12 Thread Step Christopher via swift-dev
Has this stalled out again? I would like to help with the proposal and even attempt implementation. I also need to catch up on the resilient discussion regarding enum case ordering. > On Nov 14, 2017, at 10:50 PM, Jacob Bandes-Storch via swift-evolution > wrote: > > > > Jacob Bandes-Stor

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-12-12 Thread Step Christopher via swift-dev
The “base” case desire makes sense to me, but not as a part of this proposal. It might be a good follow-on. If all associated values are enumerable, it is tempting to try to make the top level enum valueEnumerable too. I wonder if even that should be a follow-on feature. As far as source-ord

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-12-12 Thread Step Christopher via swift-dev
The “base” case desire makes sense to me, but not as a part of this proposal. It might be a good follow-on. If all associated values are enumerable, it is tempting to try to make the top level enum valueEnumerable too. I wonder if even that should be a follow-on feature. As far as source-ord

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-12-09 Thread Jonathan Hull via swift-evolution via swift-dev
> On Nov 14, 2017, at 9:06 PM, Brent Royal-Gordon via swift-dev > wrote: > >> On Nov 14, 2017, at 5:21 PM, Xiaodi Wu > > wrote: >> >> 1. It must be possible to easily access the count of values, and to access >> any particular value using contiguous `Int` indices.

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-12-09 Thread Jonathan Hull via swift-dev
> On Nov 14, 2017, at 9:06 PM, Brent Royal-Gordon via swift-dev > wrote: > >> On Nov 14, 2017, at 5:21 PM, Xiaodi Wu > > wrote: >> >> 1. It must be possible to easily access the count of values, and to access >> any particular value using contiguous `Int` indices.

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-12-09 Thread Karl Wagner via swift-dev
Personally, I think this dovetails quite nicely with the ‘random’ discussion. Enums are just one kind of type with a finite set of values; Int and Bool also fit that description, as may many structs and even classes. Having a general way to express that would be quite nice, IMO. - Karl > On 9.

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-14 Thread Jacob Bandes-Storch via swift-dev
Jacob Bandes-Storch On Tue, Nov 14, 2017 at 9:06 PM, Brent Royal-Gordon wrote: > On Nov 14, 2017, at 5:21 PM, Xiaodi Wu wrote: > > 1. It must be possible to easily access the count of values, and to access >> any particular value using contiguous `Int` indices. This could be achieved >> either

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-14 Thread Xiaodi Wu via swift-dev
On Tue, Nov 14, 2017 at 11:06 PM, Brent Royal-Gordon wrote: > On Nov 14, 2017, at 5:21 PM, Xiaodi Wu wrote: > > 1. It must be possible to easily access the count of values, and to access >> any particular value using contiguous `Int` indices. This could be achieved >> either by directly accessin

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-14 Thread Brent Royal-Gordon via swift-dev
> On Nov 14, 2017, at 5:21 PM, Xiaodi Wu wrote: > > 1. It must be possible to easily access the count of values, and to access > any particular value using contiguous `Int` indices. This could be achieved > either by directly accessing elements in the list of values through an Int > subscript,

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-14 Thread Xiaodi Wu via swift-dev
On Tue, Nov 14, 2017 at 5:49 AM, Brent Royal-Gordon wrote: > On Nov 13, 2017, at 9:21 PM, Xiaodi Wu wrote: > > ...I should add, if full conformance to `Collection` is still too much to > ask, enabling "for `case` in Foo.self" by magic would itself address the > entirety of the proposal's use cas

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-14 Thread Brent Royal-Gordon via swift-dev
> On Nov 13, 2017, at 9:21 PM, Xiaodi Wu wrote: > > ...I should add, if full conformance to `Collection` is still too much to > ask, enabling "for `case` in Foo.self" by magic would itself address the > entirety of the proposal's use case, adding no API surface area. No, Xiaodi. No, it would

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-13 Thread Xiaodi Wu via swift-dev
On Mon, Nov 13, 2017 at 11:15 PM, Xiaodi Wu wrote: > On Mon, Nov 13, 2017 at 8:16 PM, Brent Royal-Gordon < > br...@architechies.com> wrote: > >> On Nov 12, 2017, at 10:16 AM, Xiaodi Wu wrote: >> >> On Sun, Nov 12, 2017 at 4:54 AM, Brent Royal-Gordon < >> br...@architechies.com> wrote: >> >>> On

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-13 Thread Xiaodi Wu via swift-dev
On Mon, Nov 13, 2017 at 8:16 PM, Brent Royal-Gordon wrote: > On Nov 12, 2017, at 10:16 AM, Xiaodi Wu wrote: > > On Sun, Nov 12, 2017 at 4:54 AM, Brent Royal-Gordon < > br...@architechies.com> wrote: > >> On Nov 10, 2017, at 11:01 PM, Xiaodi Wu wrote: >> >> Nit: if you want to call it `ValueEnum

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-13 Thread Brent Royal-Gordon via swift-dev
> On Nov 12, 2017, at 10:16 AM, Xiaodi Wu wrote: > > On Sun, Nov 12, 2017 at 4:54 AM, Brent Royal-Gordon > wrote: >> On Nov 10, 2017, at 11:01 PM, Xiaodi Wu > > wrote: >> >> Nit: if you want to call it `ValueEnumerable`, then this shoul

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-13 Thread Andrew Bennett via swift-dev
On Mon, Nov 6, 2017 at 6:54 PM, Jacob Bandes-Storch via swift-evolution < swift-evolut...@swift.org> wrote: > Over a year ago, we discussed adding a magic "allValues"/"allCases" static > property on enums with a compiler-derived implementation. The original > proposal > PR

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-12 Thread Xiaodi Wu via swift-dev
On Sun, Nov 12, 2017 at 1:37 PM, Tony Allevato wrote: > > > On Sat, Nov 11, 2017 at 1:53 PM Xiaodi Wu wrote: > >> On Sat, Nov 11, 2017 at 3:15 PM, Tony Allevato >> wrote: >> >>> >>> >>> On Sat, Nov 11, 2017 at 10:28 AM Xiaodi Wu wrote: >>> On Sat, Nov 11, 2017 at 11:23 AM, Tony Allevato <

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-12 Thread Tony Allevato via swift-dev
On Sat, Nov 11, 2017 at 1:53 PM Xiaodi Wu wrote: > On Sat, Nov 11, 2017 at 3:15 PM, Tony Allevato > wrote: > >> >> >> On Sat, Nov 11, 2017 at 10:28 AM Xiaodi Wu wrote: >> >>> On Sat, Nov 11, 2017 at 11:23 AM, Tony Allevato >> > wrote: >>> On Fri, Nov 10, 2017 at 11:01 PM Xiaodi W

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-12 Thread Xiaodi Wu via swift-dev
On Sun, Nov 12, 2017 at 4:54 AM, Brent Royal-Gordon wrote: > On Nov 10, 2017, at 11:01 PM, Xiaodi Wu wrote: > > Nit: if you want to call it `ValueEnumerable`, then this should be > `DefaultValueCollection`. > > > I used `DefaultCaseCollection` because, although the protocol can work > with any t

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-12 Thread Brent Royal-Gordon via swift-dev
> On Nov 10, 2017, at 11:01 PM, Xiaodi Wu wrote: > > Nit: if you want to call it `ValueEnumerable`, then this should be > `DefaultValueCollection`. I used `DefaultCaseCollection` because, although the protocol can work with any type to return its values, this type can only work with enums and

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-11 Thread Xiaodi Wu via swift-dev
On Sat, Nov 11, 2017 at 3:15 PM, Tony Allevato wrote: > > > On Sat, Nov 11, 2017 at 10:28 AM Xiaodi Wu wrote: > >> On Sat, Nov 11, 2017 at 11:23 AM, Tony Allevato >> wrote: >> >>> >>> >>> On Fri, Nov 10, 2017 at 11:01 PM Xiaodi Wu via swift-evolution < >>> swift-evolut...@swift.org> wrote: >>>

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-11 Thread Tony Allevato via swift-dev
On Sat, Nov 11, 2017 at 10:28 AM Xiaodi Wu wrote: > On Sat, Nov 11, 2017 at 11:23 AM, Tony Allevato > wrote: > >> >> >> On Fri, Nov 10, 2017 at 11:01 PM Xiaodi Wu via swift-evolution < >> swift-evolut...@swift.org> wrote: >> >>> Nit: if you want to call it `ValueEnumerable`, then this should be

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-11 Thread Xiaodi Wu via swift-dev
On Sat, Nov 11, 2017 at 11:23 AM, Tony Allevato wrote: > > > On Fri, Nov 10, 2017 at 11:01 PM Xiaodi Wu via swift-evolution < > swift-evolut...@swift.org> wrote: > >> On Sat, Nov 11, 2017 at 12:15 AM, Brent Royal-Gordon via swift-evolution >> wrote: >> >>> > Personally I like the flexibility pro

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-11 Thread Tony Allevato via swift-dev
On Fri, Nov 10, 2017 at 11:01 PM Xiaodi Wu via swift-evolution < swift-evolut...@swift.org> wrote: > On Sat, Nov 11, 2017 at 12:15 AM, Brent Royal-Gordon via swift-evolution < > swift-evolut...@swift.org> wrote: > >> > Personally I like the flexibility provided by the associatedtype, but I >> also

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-10 Thread Xiaodi Wu via swift-dev
On Sat, Nov 11, 2017 at 12:15 AM, Brent Royal-Gordon via swift-evolution < swift-evolut...@swift.org> wrote: > > Personally I like the flexibility provided by the associatedtype, but I > also recognize it won't be incredibly useful for enums — more so if we > wanted to provide e.g. UInt8.allValues

Re: [swift-dev] [swift-evolution] Re-pitch: Deriving collections of enum cases

2017-11-06 Thread Tony Allevato via swift-dev
On Sun, Nov 5, 2017 at 11:54 PM Jacob Bandes-Storch via swift-evolution < swift-evolut...@swift.org> wrote: > Over a year ago, we discussed adding a magic "allValues"/"allCases" static > property on enums with a compiler-derived implementation. The original > proposal > PR