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 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] Rationalizing FloatingPoint conformance to Equatable

2017-11-14 Thread Xiaodi Wu via swift-dev
On Tue, Nov 14, 2017 at 2:34 PM, David Sweeris wrote: > > On Nov 2, 2017, at 4:22 PM, Xiaodi Wu via swift-dev > wrote: > > On Thu, Nov 2, 2017 at 5:22 PM, Matthew Johnson > wrote: > >> >> On Nov 2, 2017, at 5:20 PM, Jonathan Hull via swift-dev < >>

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-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 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-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 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-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] Rationalizing FloatingPoint conformance to Equatable

2017-11-02 Thread Xiaodi Wu via swift-dev
On Thu, Nov 2, 2017 at 7:10 PM, Stephen Canon wrote: > On Nov 2, 2017, at 7:22 PM, Xiaodi Wu via swift-dev > wrote: > > On Thu, Nov 2, 2017 at 5:22 PM, Matthew Johnson > wrote: > >> >> On Nov 2, 2017, at 5:20 PM, Jonathan Hull via swift-dev < >> swift-de

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-11-02 Thread Xiaodi Wu via swift-dev
On Thu, Nov 2, 2017 at 5:22 PM, Matthew Johnson wrote: > > On Nov 2, 2017, at 5:20 PM, Jonathan Hull via swift-dev < > swift-dev@swift.org> wrote: > > It looks like we have a good solution. Per Steve and David’s suggestions: > > 1) Make FloatingPoint == reflexive > > 2) Add &== to FloatingPoint

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-11-01 Thread Xiaodi Wu via swift-dev
On Wed, Nov 1, 2017 at 13:47 David Sweeris wrote: > > On Nov 1, 2017, at 10:21 AM, Xiaodi Wu wrote: > > > On Tue, Oct 31, 2017 at 23:43 David Sweeris wrote: > >> >> On Oct 31, 2017, at 20:58, Xiaodi Wu wrote: >> >> On Tue, Oct 31, 2017 at 10:50 PM, Xiaodi Wu wrote: >> >>> On Tue, Oct 31, 2017

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-11-01 Thread Xiaodi Wu via swift-dev
On Tue, Oct 31, 2017 at 23:43 David Sweeris wrote: > > On Oct 31, 2017, at 20:58, Xiaodi Wu wrote: > > On Tue, Oct 31, 2017 at 10:50 PM, Xiaodi Wu wrote: > >> On Tue, Oct 31, 2017 at 10:23 PM, David Sweeris >> wrote: >> >>> >>> On Oct 31, 2017, at 7:26 PM, Xiaodi Wu wrote: >>> >>> On Tue, Oct

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-31 Thread Xiaodi Wu via swift-dev
On Tue, Oct 31, 2017 at 10:50 PM, Xiaodi Wu wrote: > On Tue, Oct 31, 2017 at 10:23 PM, David Sweeris > wrote: > >> >> On Oct 31, 2017, at 7:26 PM, Xiaodi Wu wrote: >> >> On Tue, Oct 31, 2017 at 5:56 PM, David Sweeris >> wrote: >> >>> >>> On Oct 31, 2017, at 09:07, Stephen Canon via swift-dev <

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-31 Thread Xiaodi Wu via swift-dev
On Tue, Oct 31, 2017 at 10:23 PM, David Sweeris wrote: > > On Oct 31, 2017, at 7:26 PM, Xiaodi Wu wrote: > > On Tue, Oct 31, 2017 at 5:56 PM, David Sweeris > wrote: > >> >> On Oct 31, 2017, at 09:07, Stephen Canon via swift-dev < >> swift-dev@swift.org> wrote: >> >> [Replying to the thread as a

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-31 Thread Xiaodi Wu via swift-dev
On Tue, Oct 31, 2017 at 11:07 AM, Stephen Canon wrote: > [Replying to the thread as a whole] > > There have been a bunch of suggestions for variants of `==` that either > trap on NaN or return `Bool?`. I think that these suggestions result from > people getting tunnel-vision on the idea of “make

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-31 Thread Xiaodi Wu via swift-dev
On Tue, Oct 31, 2017 at 5:56 PM, David Sweeris wrote: > > On Oct 31, 2017, at 09:07, Stephen Canon via swift-dev < > swift-dev@swift.org> wrote: > > [Replying to the thread as a whole] > > There have been a bunch of suggestions for variants of `==` that either > trap on NaN or return `Bool?`. I t

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-29 Thread Xiaodi Wu via swift-dev
On Fri, Oct 27, 2017 at 5:06 AM, Jonathan Hull wrote: > > On Oct 26, 2017, at 11:44 PM, Xiaodi Wu wrote: > > On Fri, Oct 27, 2017 at 1:30 AM, Jonathan Hull wrote: > >> One completely different idea, which I brought up a year or so ago, is to >> do what we do with pointers around this. That is

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Fri, Oct 27, 2017 at 1:30 AM, Jonathan Hull wrote: > One completely different idea, which I brought up a year or so ago, is to > do what we do with pointers around this. That is you have your fast/unsafe > IEEE Floats/Doubles/etc that have a scarier name. These do not conform to > Equatable

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Fri, Oct 27, 2017 at 1:09 AM, Jonathan Hull wrote: > > On Oct 26, 2017, at 8:16 PM, Xiaodi Wu wrote: > > On Thu, Oct 26, 2017 at 4:34 PM, Jonathan Hull wrote: > >> >> On Oct 26, 2017, at 11:47 AM, Xiaodi Wu wrote: >> >> On Thu, Oct 26, 2017 at 1:30 PM, Jonathan Hull wrote: >> >>> Now you a

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 4:57 PM, Greg Parker wrote: > > On Oct 26, 2017, at 11:47 AM, Xiaodi Wu via swift-dev > wrote: > > On Thu, Oct 26, 2017 at 1:30 PM, Jonathan Hull wrote: > >> Now you are just being rude. We all want Swift to be awesome… let’s try >> to keep

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 4:34 PM, Jonathan Hull wrote: > > On Oct 26, 2017, at 11:47 AM, Xiaodi Wu wrote: > > On Thu, Oct 26, 2017 at 1:30 PM, Jonathan Hull wrote: > >> Now you are just being rude. We all want Swift to be awesome… let’s try >> to keep things civil. >> > > Sorry if my reply came

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 1:30 PM, Jonathan Hull wrote: > Now you are just being rude. We all want Swift to be awesome… let’s try to > keep things civil. > Sorry if my reply came across that way! That wasn't at all the intention. I really mean to ask you those questions and am interested in the an

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 11:50 AM, Jonathan Hull wrote: > > On Oct 26, 2017, at 9:40 AM, Xiaodi Wu wrote: > > On Thu, Oct 26, 2017 at 11:38 AM, Jonathan Hull wrote: > >> >> On Oct 26, 2017, at 9:34 AM, Xiaodi Wu wrote: >> >> On Thu, Oct 26, 2017 at 10:57 AM, Jonathan Hull wrote: >> >>> >>> On

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 11:38 AM, Jonathan Hull wrote: > > On Oct 26, 2017, at 9:34 AM, Xiaodi Wu wrote: > > On Thu, Oct 26, 2017 at 10:57 AM, Jonathan Hull wrote: > >> >> On Oct 26, 2017, at 8:19 AM, Xiaodi Wu wrote: >> >> >> On Thu, Oct 26, 2017 at 07:52 Jonathan Hull wrote: >> >>> On Oct 2

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 10:57 AM, Jonathan Hull wrote: > > On Oct 26, 2017, at 8:19 AM, Xiaodi Wu wrote: > > > On Thu, Oct 26, 2017 at 07:52 Jonathan Hull wrote: > >> On Oct 25, 2017, at 11:22 PM, Xiaodi Wu wrote: >> >> On Wed, Oct 25, 2017 at 11:46 PM, Jonathan Hull wrote: >> >>> As someone

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-26 Thread Xiaodi Wu via swift-dev
On Thu, Oct 26, 2017 at 07:52 Jonathan Hull wrote: > On Oct 25, 2017, at 11:22 PM, Xiaodi Wu wrote: > > On Wed, Oct 25, 2017 at 11:46 PM, Jonathan Hull wrote: > >> As someone mentioned earlier, we are trying to square a circle here. We >> can’t have everything at once… we will have to prioritiz

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-25 Thread Xiaodi Wu via swift-dev
On Wed, Oct 25, 2017 at 11:46 PM, Jonathan Hull wrote: > As someone mentioned earlier, we are trying to square a circle here. We > can’t have everything at once… we will have to prioritize. I feel like the > precedent in Swift is to prioritize safety/correctness with an option > ignore safety an

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-25 Thread Xiaodi Wu via swift-dev
On Wed, Oct 25, 2017 at 9:05 PM, David Zarzycki wrote: > > > On Oct 25, 2017, at 19:25, Xiaodi Wu wrote: > > I was proposing something different where Float and Int are both Equatable >> and Substitutable, but neither Equatable nor Substitutable inherit from the >> other. The former is mathemati

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-25 Thread Xiaodi Wu via swift-dev
On Wed, Oct 25, 2017 at 8:26 PM, Jonathan Hull wrote: > > On Oct 25, 2017, at 9:01 AM, David Sweeris via swift-dev < > swift-dev@swift.org> wrote: > > > > That said, I fully acknowledge that this is all above my pay grade (also > I hadn't realized that the issue was as settled as it apparently is

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-25 Thread Xiaodi Wu via swift-dev
On Wed, Oct 25, 2017 at 12:06 PM, David Zarzycki wrote: > > > On Oct 25, 2017, at 12:01, David Sweeris wrote: > > > On Oct 25, 2017, at 5:29 AM, David Zarzycki via swift-dev < > swift-dev@swift.org> wrote: > > > > On Oct 25, 2017, at 02:34, Xiaodi Wu

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-24 Thread Xiaodi Wu via swift-dev
On Wed, Oct 25, 2017 at 1:24 AM, David Sweeris wrote: > > On Oct 24, 2017, at 9:06 PM, Xiaodi Wu via swift-dev > wrote: > > On Tue, Oct 24, 2017 at 10:08 PM, Ben Cohen wrote: > >> >> >> On Oct 24, 2017, at 6:48 PM, Xiaodi Wu wrote: >> >> O

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-24 Thread Xiaodi Wu via swift-dev
On Tue, Oct 24, 2017 at 10:08 PM, Ben Cohen wrote: > > > On Oct 24, 2017, at 6:48 PM, Xiaodi Wu wrote: > > On Tue, Oct 24, 2017 at 1:55 PM, Ben Cohen wrote: > >> >> >> On Oct 19, 2017, at 4:29 PM, Xiaodi Wu via swift-dev >> wrote: >> >>

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-24 Thread Xiaodi Wu via swift-dev
On Tue, Oct 24, 2017 at 4:28 PM, David Zarzycki wrote: > > > On Oct 24, 2017, at 14:55, Ben Cohen via swift-dev > wrote: > > There really is no way to square this circle. Every option is going to > have downsides. We have to balance correctness, least surprise/most > expected behavior for most p

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-24 Thread Xiaodi Wu via swift-dev
On Tue, Oct 24, 2017 at 1:55 PM, Ben Cohen wrote: > > > On Oct 19, 2017, at 4:29 PM, Xiaodi Wu via swift-dev > wrote: > > Differing behavior in generic and concrete contexts is simply too subtle > to be understandable to the reader. > > > Hardly more subtle the

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-23 Thread Xiaodi Wu via swift-dev
On Mon, Oct 23, 2017 at 12:47 AM, Brent Royal-Gordon wrote: > > On Oct 21, 2017, at 6:27 PM, Xiaodi Wu via swift-dev < > swift-dev@swift.org> wrote: > > > > Steve can describe the exact number of additional machine instructions > on each architecture, but from my c

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-21 Thread Xiaodi Wu via swift-dev
PM, Stephen Canon wrote: >> >>> On Oct 20, 2017, at 8:21 AM, David Zarzycki via swift-dev < >>> swift-dev@swift.org> wrote: >>> >>> >>> On Oct 20, 2017, at 07:51, Xiaodi Wu via swift-dev >>> wrote: >>> >>> On Fri,

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-21 Thread Xiaodi Wu via swift-dev
gt;> >> >> On Oct 20, 2017, at 07:51, Xiaodi Wu via swift-dev >> wrote: >> >> On Fri, Oct 20, 2017 at 1:22 AM, Jonathan Hull wrote: >> >>> +1 for trapping unless using &==. In the case of ‘Float?’ we could also >>> map to nil. >>&

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-21 Thread Xiaodi Wu via swift-dev
On Fri, Oct 20, 2017 at 2:42 PM, Stephen Canon wrote: > On Oct 20, 2017, at 8:21 AM, David Zarzycki via swift-dev < > swift-dev@swift.org> wrote: > > > On Oct 20, 2017, at 07:51, Xiaodi Wu via swift-dev > wrote: > > On Fri, Oct 20, 2017 at 1:22 AM, Jonathan Hul

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-20 Thread Xiaodi Wu via swift-dev
On Fri, Oct 20, 2017 at 10:10 Matthew Johnson wrote: > On Oct 20, 2017, at 9:36 AM, Xiaodi Wu via swift-dev > wrote: > > > On Fri, Oct 20, 2017 at 07:21 David Zarzycki wrote: > >> >> >> On Oct 20, 2017, at 07:51, Xiaodi Wu via swift-dev >> wr

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-20 Thread Xiaodi Wu via swift-dev
On Fri, Oct 20, 2017 at 10:05 Jonathan Hull wrote: > > On Oct 20, 2017, at 7:36 AM, Xiaodi Wu wrote: > > > On Fri, Oct 20, 2017 at 07:21 David Zarzycki wrote: > >> >> >> On Oct 20, 2017, at 07:51, Xiaodi Wu via swift-dev >> wrote: >> >>

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-20 Thread Xiaodi Wu via swift-dev
On Fri, Oct 20, 2017 at 07:21 David Zarzycki wrote: > > > On Oct 20, 2017, at 07:51, Xiaodi Wu via swift-dev > wrote: > > On Fri, Oct 20, 2017 at 1:22 AM, Jonathan Hull wrote: > >> +1 for trapping unless using &==. In the case of ‘Float?’ we could also >>

Re: [swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-20 Thread Xiaodi Wu via swift-dev
n via swift-dev < > swift-dev@swift.org> wrote: > > On Oct 19, 2017, at 4:29 PM, Xiaodi Wu via swift-dev > wrote: > > D) Must floating-point IEEE-compliant equivalence be spelled `==`? > > In my view, this is something open for debate. I see no reason why it > canno

[swift-dev] Rationalizing FloatingPoint conformance to Equatable

2017-10-19 Thread Xiaodi Wu via swift-dev
Ben Cohen asked to continue this conversation on swift-dev-- Included in PR #12503 is a small tweak to accommodate so-called "exceptional values" (such as NaN) in comparisons of array equality. Currently, `Array.==` first looks to referential equality of underlying buffers, then (if false) compa

Re: [swift-dev] What can you change in a non-exhaustive enum?

2017-09-30 Thread Xiaodi Wu via swift-dev
On Sat, Sep 30, 2017 at 11:58 AM, wrote: > Message: 2 > Date: Fri, 29 Sep 2017 18:21:44 -0700 > From: Jordan Rose > To: swift-dev > Subject: [swift-dev] What can you change in a non-exhaustive enum? > Message-ID: <31df689e-1ad3-47cb-9fce-6cbc7e34b...@apple.com> > Content-Type: text/plain; chars

[swift-dev] Completing DoubleWidth

2017-04-18 Thread Xiaodi Wu via swift-dev
Thrilled that the new integer protocols have been merged! Just for fun, I've started taking a stab at the low-hanging fruit in DoubleWidth and wanted to check in here to make sure that tightening up that implementation would be welcome/not duplicative. _

[swift-dev] [SE-0134] Source-breaking proposal implementation

2016-07-28 Thread Xiaodi Wu via swift-dev
PRs: apple/swift#3816 and apple/swift-corelibs-foundation#486 Thanks, Xiaodi ___ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev