[swift-evolution] ? suffix for <, >, <=, >= comparisons with optionals to prevent subtle bugs

Amir Michail a.michail at me.com
Thu Dec 3 17:42:03 CST 2015


Such comparisons with optionals can result in hard to find bugs.

For example consider:

let f = x < 5  // x is of type Int? and may be nil

The proposed ? suffix would be used as follows and makes the possibility of nil very clear:

let f = x? < 5




More information about the swift-evolution mailing list