Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-06 Thread Karl via swift-evolution
> On 4 Jul 2016, at 18:55, Anton Zhilin wrote: > > 2016-07-04 18:34 GMT+03:00 Karl via swift-evolution > >: > Now that you mention it; why is Bool not an enum? > > Probably, for the same reason Int is not an

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-06 Thread Vladimir.S via swift-evolution
On 05.07.2016 13:33, James Campbell via swift-evolution wrote: Would love a real life scenario of why you would need this. Some kind of pre-initialization(for GUI as example) for all possible kinds of values, that you should process then (for GUI - let's say add to needed list).

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-05 Thread Karl via swift-evolution
> On 5 Jul 2016, at 12:47, Charlie Monroe via swift-evolution > wrote: > > This is mentioned in Gabriel's proposal: > >> Implement a native .cases static var for all enumerations without associated >> values > > > But as has been mentioned in the discussion, this

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-05 Thread James Campbell via swift-evolution
Maybe a way we could opt in is by only doing this for enums with out turples? i.e enum ABTestingBrah { case A case B } I'm not sure if enums that take turples would need this functionality. *___* *James⎥Head of Trolls* *ja...@supmenow.com

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-05 Thread Charlie Monroe via swift-evolution
Example: enum MediaKind { case HomeVideo, Movie, MusicVideo, TVShow var localizedName: String { ... } } let popUpButton: NSPopUpButton = ... for kind in MediaKind.allKinds { popUpButton.addItemWithTitle(kind.localizedName) } And many, many more. > On Jul 5, 2016, at

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-05 Thread James Campbell via swift-evolution
Would love a real life scenario of why you would need this. *___* *James⎥Head of Trolls* *ja...@supmenow.com ⎥supmenow.com * *Sup* *Runway East * *10 Finsbury Square* *London* * EC2A 1AF * On 4 July 2016 at 02:36,

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Leonardo Pessoa via swift-evolution
And it is something the compiler can check whether it is necessary for your code or not based on some simple and easy pattern. If it is so simple, why not let the compiler handle it? On 4 July 2016 at 16:02, Vladimir.S via swift-evolution wrote: > On 04.07.2016 21:21,

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Vladimir.S via swift-evolution
On 04.07.2016 21:21, Brent Royal-Gordon via swift-evolution wrote: On Jul 4, 2016, at 10:43 AM, Leonardo Pessoa wrote: My issue with this being opt-in is third-party libraries. That's why we have retroactive modeling. :^) import SomeEnumKit extension

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Jacob Bandes-Storch via swift-evolution
On Mon, Jul 4, 2016 at 12:14 AM, Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > > On Jul 3, 2016, at 6:36 PM, Gabriel Lanata via swift-evolution < > swift-evolution@swift.org> wrote: > > > > Hello, this has been proposed multiple times before in different ways. > >

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Brent Royal-Gordon via swift-evolution
> On Jul 4, 2016, at 10:43 AM, Leonardo Pessoa wrote: > > My issue with this being opt-in is third-party libraries. That's why we have retroactive modeling. :^) import SomeEnumKit extension SomeEnum: ValuesEnumerable {} You can extend another module's public

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Leonardo Pessoa via swift-evolution
My issue with this being opt-in is third-party libraries. The developer of a library may not have intended or thought of a use for the enum this way but some other developer might have. Being opt-in would prevent such scenarios from easily happening or require the developer to (again) manually

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Leonardo Pessoa via swift-evolution
That is actually something I argued over this list with other users and (at least when I proposed) was not very well accepted. This certainly has my +1. On 4 July 2016 at 02:52, Gabriel Lanata via swift-evolution wrote: > I know! I am amazed this hasn’t had a formal

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Anton Zhilin via swift-evolution
2016-07-04 18:34 GMT+03:00 Karl via swift-evolution < swift-evolution@swift.org>: > > Now that you mention it; why is Bool *not* an enum? > Probably, for the same reason Int is not an enum. ___ swift-evolution mailing list swift-evolution@swift.org

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Karl via swift-evolution
> On 4 Jul 2016, at 09:14, Brent Royal-Gordon via swift-evolution > wrote: > >> On Jul 3, 2016, at 6:36 PM, Gabriel Lanata via swift-evolution >> wrote: >> >> Hello, this has been proposed multiple times before in different ways. > >

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Brent Royal-Gordon via swift-evolution
> On Jul 3, 2016, at 6:36 PM, Gabriel Lanata via swift-evolution > wrote: > > Hello, this has been proposed multiple times before in different ways. It has indeed. Unfortunately, for various reasons it did not get into review in time, and Swift 3 is basically

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-04 Thread Karl via swift-evolution
+1 Finally, let’s get it done > On 4 Jul 2016, at 03:36, Gabriel Lanata via swift-evolution > wrote: > > Hello, this has been proposed multiple times before in different ways. > > Link to detailed proposal draft: >

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-03 Thread Gabriel Lanata via swift-evolution
I know! I am amazed this hasn’t had a formal proposal and review yet. I did a search through the mailing list and found that it has been mentioned many times before (these mentions are linked in the proposal) but it has never gone into review. The other posts proposed slightly different

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-03 Thread Tino Heth via swift-evolution
Hi there, right now, I have 7115 unread messages in my Swift-folder, so I'm surprised that there hasn't already been a successful proposal to add this feature… afaiks, it wouldn't hurt anybody, and many people want to have it. Therefore: +1, and good luck! ;-)

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-03 Thread Guillermo Peralta Scura via swift-evolution
+1. The only thing that I don't like is that it may lead to confusion to novice developers because it only work with "basic" enums i.e. enums without associated values. The same thing happens with protocols with associated types, where you can't use the protocol with associated types as the type

Re: [swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-03 Thread Saagar Jha via swift-evolution
+1 since it makes it easy to get the number of possible enum values, but I thought I'd tell you: there's no "Wind" type in Pokémon. It's "Flying". On Sun, Jul 3, 2016 at 18:36 Gabriel Lanata via swift-evolution < swift-evolution@swift.org> wrote: > Hello, this has been proposed multiple times

[swift-evolution] [Proposal] Allow enumerating cases in enumerations

2016-07-03 Thread Gabriel Lanata via swift-evolution
Hello, this has been proposed multiple times before in different ways. Link to detailed proposal draft: https://github.com/gabriellanata/swift-evolution/blob/master/proposals/-allow-enumerating-cases-in-enumerations.md It is currently not possible to enumerate through all the possible cases