[swift-evolution] [swift-evolution-announce] [Review] SE-0023 API Design Guidelines

Ricardo Parada rparada at mac.com
Tue Feb 2 11:51:53 CST 2016


Oops, I just realized I made some typos.  Here it goes again with my typos corrected:


I reviewed SetAlgebra quickly and I think it could conform to the guidelines better if it used the something like this:

// Non-mutable methods
let union = a.adding(b)				// returns a ∪ b
let intersection = a.intersecting(b)		// returns a ∩ b
let difference = a.subtracting(b)		// returns a - b
let xor = a.xoring(b)  					// returns a △ b (a.k.a. "symmetric difference" or "exclusive or")

// Mutable methods (in-place)
a.add(b)
a.intersect(b)
a.subtract(b)
a.xor(b)

Thanks



> On Feb 2, 2016, at 11:40 AM, Ricardo Parada via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi Dave,
> 
> Let me add the following to my ideas on union().  I actually reviewed SetAlgebra quickly and I think it could conform to the guidelines better if it used the following:
> 
> // Non-mutable methods
> let union = a.adding(b)				// returns a ∪ c
> let intersection = a.intersecting(b)		// returns a ∩ c
> let difference = a.subtracting(b)		// returns a - b
> let xor = a.xoring(b)  					// returns a △ b (a.k.a. "symmetric difference" or "exclusive or")
> 
> // Mutable methods (in-place)
> a.add(b)
> a.intersect(b)
> a.subtract(b)
> a.xor(b)
> 
> Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160202/9fcace2b/attachment.html>


More information about the swift-evolution mailing list