[swift-evolution] [Review #2] SE-0067: Enhanced Floating Point Protocols

Nicola Salmoria nicola.salmoria at gmail.com
Tue Apr 26 09:03:00 CDT 2016


Forgive me if this has been answered already, but is

func isLessThanOrEqualTo(_ other: Self) -> Bool

really needed?

I understand the lack of trichotomy. But can’t this simply be implemented using the other existing methods?

Consider that the consumers of the types will normally use the global operators instead of the protocol methods. So instead of

func <= <T: FloatingPoint>(lhs: T, rhs: T) -> Bool
{  
	return lhs.isLessThanOrEqualTo(rhs)
}

it should be enough to do

func <= <T: FloatingPoint>(lhs: T, rhs: T) -> Bool
{  
	return lhs.isLess(than: rhs) || lhs.isEqual(to: rhs)
}

Or is there some case of x, y where (x <= y) is true but (x < y) and (x == y) are both false?

Thanks,
Nicola


> Hello Swift community,
> 
> Steve opted to revise his original proposal in order to incorporate great feedback from the original review period. As such, we’re extending the review period in order to get adequate consideration of his new changes. The extended review of "SE-0067: Enhanced Floating Point Protocols" runs through April 29. The proposal is available here:
> 
> https://github.com/apple/swift-evolution/blob/master/proposals/0067-floating-point-protocols.md
> 
> His previous revision is available here:
> 
> https://github.com/apple/swift-evolution/blob/fb1368a6a5474f57aa8f1846b5355d18753098f3/proposals/0067-floating-point-protocols.md
> 
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at:
> 
> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> or, if you would like to keep your feedback private, directly to the review manager.
> 
> What goes into a review?
> 
> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
> 
> * What is your evaluation of the proposal?
> * Is the problem being addressed significant enough to warrant a change to Swift?
> * Does this proposal fit well with the feel and direction of Swift?
> * If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> 
> More information about the Swift evolution process is available at
> 
> https://github.com/apple/swift-evolution/blob/master/process.md
> 
> Thank you,
> 
> -Chris Lattner
> Review Manager
> 
> 
> 


More information about the swift-evolution mailing list