Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-14 Thread Hooman Mehr via swift-evolution
A strong +1 on this approach instead of the current revision of SE-0194. This is a very focused solution to a very focused need. It sidesteps the issues of a protocol based approach (potential for abuse or deciding/defining the intended uses of such protocol). Also, we already have the

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-14 Thread Ben Rimmington via swift-evolution
An alternative is a special #knownCases(of:) literal. Its value is an array literal of the enum cases known at compile time. This could also work with enums imported from Objective-C. -- Ben > On 10 Jan 2018, at 22:54, Jordan Rose wrote: > > [Proposal: >

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-13 Thread Xiaodi Wu via swift-evolution
On Wed, Jan 10, 2018 at 5:06 AM, Brent Royal-Gordon wrote: > On Jan 9, 2018, at 10:26 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > I continue to have concerns about this proposal, and I'm gravely and very > bitterly disappointed that the

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-12 Thread Paul Cantrell via swift-evolution
> On Jan 11, 2018, at 11:42 PM, Brent Royal-Gordon > wrote: > >> On Jan 11, 2018, at 4:21 PM, Paul Cantrell > > wrote: >> >> This raises a question related to Chris’s: what is the utility of having >> Limb conform to a

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-12 Thread Vladimir.S via swift-evolution
On 11.01.2018 1:54, Jordan Rose via swift-evolution wrote: [Proposal: https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md] I think this is generally reasonable, and none of the names offend me enough to weigh in on that discussion. I do think

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Chris Lattner via swift-evolution
> On Jan 11, 2018, at 9:26 PM, Gwendal Roué via swift-evolution > wrote: > > Hello, > >> Le 12 janv. 2018 à 02:36, Paul Cantrell via swift-evolution >> a écrit : >> >> The question I was weighing on it — what I thought Chris and Brent

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Gwendal Roué via swift-evolution
> Le 12 janv. 2018 à 06:42, Brent Royal-Gordon via swift-evolution > a écrit : > > Basically, having `ValueEnumerable` be a formal protocol means we can extend > this small automatic behavior into larger automatic behaviors. I can imagine, > for instance, building

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Jacob Bandes-Storch via swift-evolution
On Wed, Jan 10, 2018 at 3:06 AM, Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > On Jan 9, 2018, at 10:26 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > I continue to have concerns about this proposal, and I'm gravely and very > bitterly

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Brent Royal-Gordon via swift-evolution
> On Jan 11, 2018, at 4:21 PM, Paul Cantrell wrote: > > This raises a question related to Chris’s: what is the utility of having Limb > conform to a protocol instead of just providing allValues ad hoc? Does > CaseEnumerable / ValueEnumerable serve any purpose other than

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Gwendal Roué via swift-evolution
Hello, > Le 12 janv. 2018 à 02:36, Paul Cantrell via swift-evolution > a écrit : > > The question I was weighing on it — what I thought Chris and Brent were > discussing — was whether this new protocol should be used narrowly for cases > of enums without associated

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Howard Lovatt via swift-evolution
I missed that sorry. I think it will find other uses and therefore should be ValueEnumerable. -- Howard. > On 11 Jan 2018, at 6:36 pm, Paul Cantrell wrote: > >> On Jan 11, 2018, at 7:28 PM, Howard Lovatt wrote: >> >> I am in favour of a protocol

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Paul Cantrell via swift-evolution
> On Jan 11, 2018, at 7:28 PM, Howard Lovatt wrote: > > I am in favour of a protocol that you have to explicitly declare, it feels > much more like Swift to me. For example you have to say Equatable explicitly. Howard — Either you’ve missed something or I have. I

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Howard Lovatt via swift-evolution
I am in favour of a protocol that you have to explicitly declare, it feels much more like Swift to me. For example you have to say Equatable explicitly. As a contra example in Java it feels natural that the compiler just provides the functionality because that is consistent across the

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-11 Thread Paul Cantrell via swift-evolution
> On Jan 10, 2018, at 10:21 PM, Chris Lattner via swift-evolution > wrote: > > Brent, thanks for the detailed response, one question about it: > >> On Jan 10, 2018, at 3:06 AM, Brent Royal-Gordon via swift-evolution >> wrote: >> >> But

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Chris Lattner via swift-evolution
Brent, thanks for the detailed response, one question about it: > On Jan 10, 2018, at 3:06 AM, Brent Royal-Gordon via swift-evolution > wrote: > > But that's beside the point. What I think the "`allValues` should be allowed > to be infinite" suggestion misses is

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Xiaodi Wu via swift-evolution
On Wed, Jan 10, 2018 at 5:06 AM, Brent Royal-Gordon wrote: > On Jan 9, 2018, at 10:26 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > I continue to have concerns about this proposal, and I'm gravely and very > bitterly disappointed that the

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Cheyo Jimenez via swift-evolution
On Jan 10, 2018, at 8:22 AM, Paul Cantrell via swift-evolution wrote: >> What is your evaluation of the proposal? > > +1. Yes please. Long overdue. > >> Is the problem being addressed significant enough to warrant a change to >> Swift? > > It’s a long-standing

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Jordan Rose via swift-evolution
[Proposal: https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md] I think this is generally reasonable, and none of the names offend me enough to weigh in on that discussion. I do think it's a little weird that @objc enums defined in Swift

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Paul Cantrell via swift-evolution
> On Jan 10, 2018, at 2:23 PM, Kevin Nattinger wrote: > >> [...] >> >> I don’t agree that the Collection should be Int-indexed. Source-order is not >> a very strong guarantee IMO, and it wouldn’t be good if people started >> writing things like "MyEnum.allValues[3]” to

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Kevin Nattinger via swift-evolution
> [...] > > I don’t agree that the Collection should be Int-indexed. Source-order is not > a very strong guarantee IMO, and it wouldn’t be good if people started > writing things like "MyEnum.allValues[3]” to reference a specific case. So how do you propose to use allValues with a table view?

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Paul Cantrell via swift-evolution
> On Jan 10, 2018, at 12:44 PM, Karl Wagner wrote: > > > >> On 10. Jan 2018, at 17:22, Paul Cantrell via swift-evolution >> > wrote: >> >>> What is your evaluation of the proposal? >> >> +1. Yes please. Long

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Dave DeLong via swift-evolution
Yes please to Int indexes. One of the things I despise most about the Collection protocol is how it allows for arbitrary index types. That, IMO, was an awful, awful mistake. Dave > On Jan 10, 2018, at 11:45 AM, C. Keith Ray via swift-evolution > wrote: > > Simple

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread C. Keith Ray via swift-evolution
Simple is better. Int indexes, please. -- C. Keith Ray * https://leanpub.com/wepntk <- buy my book? * http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf * http://agilesolutionspace.blogspot.com/ > On Jan 10, 2018, at 10:44 AM, Karl Wagner via swift-evolution >

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Karl Wagner via swift-evolution
> On 10. Jan 2018, at 17:22, Paul Cantrell via swift-evolution > wrote: > >> What is your evaluation of the proposal? > > +1. Yes please. Long overdue. > >> Is the problem being addressed significant enough to warrant a change to >> Swift? > > It’s a

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Paul Cantrell via swift-evolution
> What is your evaluation of the proposal? +1. Yes please. Long overdue. > Is the problem being addressed significant enough to warrant a change to > Swift? It’s a long-standing sore thumb. The proposal’s evidence of community demand fits my own experience: I’ve wanted this on multiple

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-10 Thread Brent Royal-Gordon via swift-evolution
> On Jan 9, 2018, at 10:26 PM, Xiaodi Wu via swift-evolution > wrote: > > I continue to have concerns about this proposal, and I'm gravely and very > bitterly disappointed that the concerns have not even been acknowledged in > the Alternatives section, which is in

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Antoine Cœur via swift-evolution
I read: Ma.allValues.count // returns 8 But that sounds like all values will need to be computed in order to get the count, so some people will be tempted to write: Ma.lazy.allValues.count // returns 8 To avoid that, it may be nicer to make enum `Ma` behaves like a collection directly, so

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Chris Lattner via swift-evolution
On Jan 9, 2018, at 10:26 PM, Xiaodi Wu via swift-evolution wrote: > My objection to the "ValueEnumerable" design--especially in its generalized > form here (versus "CaseEnumerable")--is that the protocol's semantics (and, > we'll recall, protocols in Swift must offer

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Xiaodi Wu via swift-evolution
On Mon, Jan 8, 2018 at 1:02 PM, Douglas Gregor via swift-evolution < swift-evolution@swift.org> wrote: > Hello Swift community, > > The review of SE-0194 "Derived Collection of Enum Cases" begins now and > runs through January 11, 2018. The proposal is available here: > >

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Vladimir.S via swift-evolution
On 09.01.2018 21:43, Kevin Nattinger via swift-evolution wrote: Proposal link: https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md *

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Cheyo Jimenez via swift-evolution
> On Jan 9, 2018, at 10:43 AM, Kevin Nattinger via swift-evolution > wrote: > >> Proposal link: >> >> https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md >> >> What is your evaluation of the proposal? > +1 on the

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Kevin Nattinger via swift-evolution
> Proposal link: > > https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md > > >

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Daniel Steinberg via swift-evolution
> > What is your evaluation of the proposal? +1 it’s something I often hack myself > Is the problem being addressed significant enough to warrant a change to > Swift? Yes > Does this proposal fit well with the feel and direction of Swift? Yes - I think it will encourage the use of enumerations

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Riley Testut via swift-evolution
I’m overall +1, but I’m curious: would you be able to conform an enum from another module to ValueEnumerable via an extension, and still have the compiler generate the protocol requirements for you? I can imagine that the client of a framework with an enum may have a valid use for iterating

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-09 Thread Tony Allevato via swift-evolution
On Mon, Jan 8, 2018 at 11:02 AM Douglas Gregor via swift-evolution < swift-evolution@swift.org> wrote: > Hello Swift community, > > The review of SE-0194 "Derived Collection of Enum Cases" begins now and > runs through January 11, 2018. The proposal is available here: > > >

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread Cheyo Jimenez via swift-evolution
> What is your evaluation of the proposal? +1 How does this work with public non exhaustive enums? Can we have a version of this that is compile time only? This would be very helpful specially if non exhaustive enums make it into the language. Perhaps also having compile time allCases could

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread David Waite via swift-evolution
> https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md > > > What is your evaluation of the proposal? Generally +1 I would like the

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread Letanyan Arumugam via swift-evolution
> What is your evaluation of the proposal? +1 This is a very useful feature. > Is the problem being addressed significant enough to warrant a change to > Swift? Yes for what I’ve wanted to do. > Does this proposal fit well with the feel and direction of Swift? It fits the design of similar

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread Jarod Long via swift-evolution
> > • What is your evaluation of the proposal? > +1, very happy to see this coming together! I've been interested in this feature since the early days of Swift. My only reservation is that I would have expected to be able to access the list of values without any extra annotations. Is there a

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread Rod Brown via swift-evolution
> What is your evaluation of the proposal? +1 to the idea. Disappointing that we don’t seem to be able to add this to @objc enums. Could we come up with some kind of workaround for this? > Is the problem being addressed significant enough to warrant a change to > Swift? Yes, this is a common

Re: [swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread David Hart via swift-evolution
> What is your evaluation of the proposal? I’m hugely in favour of the proposal but am quite worried about that fact that ValueEnumerable will not work for @objc enums and enums imported from C/Obj-C headers. It seems like a very common scenario and the lack of support for it will be both

[swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

2018-01-08 Thread Douglas Gregor via swift-evolution
Hello Swift community, The review of SE-0194 "Derived Collection of Enum Cases" begins now and runs through January 11, 2018. The proposal is available here: https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md Reviews are an important part of