[swift-evolution] mandatory "?" suffix for identifiers associated with optional types

Chris Lattner clattner at apple.com
Sun Dec 6 16:39:34 CST 2015

> On Dec 4, 2015, at 7:20 AM, Amir Michail <a.michail at me.com> wrote:
> So for example the following (probable) bug would result in a compile error:
> let f = x < 5 // where x is optional and could be nil
> If that was really what was intended, you would need to write:
> let f = x? < 5

I don’t think this approach can work.

Consider the == operator for example: if optionals are are equatable then they will work with ==.  If they are not, they cannot be used as a dictionary key.  The former approach defeats your goals, the later approach defeats common problems from being solved.


More information about the swift-evolution mailing list