Re: [swift-corelibs-dev] [swift-evolution] Proposal: Conforming NSDate to Comparable

2015-12-06 Thread Stephen Celis via swift-corelibs-dev
Seems to me that anything with `-compare:` could conform to Comparable. The list, however, is surprisingly short, and half bridge over to native Swift types that are already Comparable: - [NSDate compare:] - [NSIndexPath compare:] - [NSNumber compare:] - [NSString compare:] Looks like NSIndexPa

Re: [swift-corelibs-dev] [swift-evolution] Proposal: Conforming NSDate to Comparable

2015-12-06 Thread Alexander Kolov via swift-corelibs-dev
I also agree, since all methods already exist in NSDate. Conforming it to Comparable and Strideable is just making interface more in line with Swift spirit. > On Dec 6, 2015, at 11:05 AM, Brent Royal-Gordon via swift-corelibs-dev > wrote: > >> I agree that it makes perfect sense for NSDate to

Re: [swift-corelibs-dev] [swift-evolution] Proposal: Conforming NSDate to Comparable

2015-12-05 Thread Zachary Waldowski via swift-corelibs-dev
> It is simply not the case that *all* arithmetic on NSDates is incorrect > unless it involves NSCalendar and NSDateComponents. But then the same logic would follow that String must have all sorts of convenient but incorrect API on it, because it is simply not the case that all character transfo

Re: [swift-corelibs-dev] [swift-evolution] Proposal: Conforming NSDate to Comparable

2015-12-05 Thread Brent Royal-Gordon via swift-corelibs-dev
> NSDate (and dates/timestamps in general) is a poor choice for Strideable, > because, DST. > A Calendar using this interface for a repeating event would be broken using > this. Or you would break anyone who really wants to iterate every fixed 86400 > seconds. Sometimes you want to add an inter

Re: [swift-corelibs-dev] [swift-evolution] Proposal: Conforming NSDate to Comparable

2015-12-05 Thread Brent Royal-Gordon via swift-corelibs-dev
> I think it's a good idea to conform NSDate to the Comparable protocol, so > instead of using: > > if someDate.compare(today) == .OrderedAscending { } > > Developers can easily compare using compare dates using comparison operators: > > if someDate < today { } I would also suggest we add Stri