[swift-evolution] Proposal: x == 2 should not be a valid statement

Jessy Catterwaul mr.jessy at gmail.com
Thu Feb 11 18:22:27 CST 2016

> “==“ for equivalence isn’t broken.   It doesn’t need fixing.
> -jcr

It’s two equals signs. Or three equals signs. People can do better than this.


> The assignment operator (=) does not return a value, to prevent it from being mistakenly used when the equal to operator (==) is intended.

The history of this badness is crumbling.

Perhaps the solution is to first do a better job of assignment, freeing up the operator for comparison without semantic overload?

let string = ""
var int = 2
int = 3

string, be ""
var int, be 2
int, be 3

string be ""
var int be 2
int be 3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160211/9018ba76/attachment.html>

More information about the swift-evolution mailing list