[swift-evolution] Why have both bit-wise and logical operators?
felixcca at gmail.com
Sat Aug 13 00:38:00 CDT 2016
Also, bitwise operators have precedence over comparison operators. `if foo == bar && baz == frob` would have to be replaced with `if (foo == bar) & (baz == frob)`.
> Le 12 août 2016 à 14:59:27, John McCall via swift-evolution <swift-evolution at swift.org> a écrit :
>> 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.
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution