[swift-evolution] Proposal: Python's "in" and "not in" syntactic sugar

Amir Michail a.michail at me.com
Thu Dec 17 08:59:44 CST 2015


> On Dec 17, 2015, at 9:51 AM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> if “hello” in [“hello, there”] { … }
>> 
>> if “hello” not in [“hello, there”] { … }
> 
> Swift is extremely sparing with keywords in operator position; the only ones I can think of off the top of my head are `is` and `as`, and even those aren’t actually operators. You’re proposing to introduce one as syntactic sugar for [array].contains(elem), and introduce an even more bizarre two-word operator for ![array].contains(elem). I don’t think that’s gonna fly.

Most programmers would probably love using them though.

> 
> -- 
> Brent Royal-Gordon
> Architechies
> 



More information about the swift-evolution mailing list