> On Mar 26, 2016, at 7:13 PM, Erica Sadun <[email protected]> wrote:
> 
> if 200...299 ~= statusCode { print("within 200-299") }

Yes, I should have touched on this one too.

My concern here is one of the concerns of the case version, it's cart before 
the horse. General programming practice for tests is something like:

(the thing you want to test) (the test) (what you test against)

This syntax reverses that ordering. Sure, this is a purely stylistic concern, 
but so much in programming is.

As someone else noted, we could simply allow this to be reversed, but that 
raises the question of why bother?

We already have the "in" operator. Everyone knows it, because you have to, 
especially under Swift 3. Using it in the if statement works exactly the same 
way it does in the for. And it requires nothing new to learn, unlike ~= which 
is an edge use-case.

_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to