[swift-evolution] Why have both bit-wise and logical operators?

John McCall rjmccall at apple.com
Fri Aug 12 16:59:27 CDT 2016

> On Aug 12, 2016, at 2:57 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
> Since integers don’t have an implicit logical value in Swift, and since booleans don’t have implicit integer values, why do we need separate operators for concepts that essentially seem (to me, anyway) to only differ by the “bit depth” of the types they operate on?
> I normally wouldn’t raise this at a time when everyone’s so busy, but breaking changes and whatnot…

The logical operators short-circuit.  Also, they're used in really different ways; having them be spelled differently is communicatively powerful.


More information about the swift-evolution mailing list