[swift-evolution] [Discussion] Breaking precedence

Boris Wang kona.ming at gmail.com
Tue Aug 2 19:09:54 CDT 2016

C is my working language,I don' want to remember too much rules for
operator, just use parentheses.

It's more reliable than the complicated rules.

Xiaodi Wu via swift-evolution <swift-evolution at swift.org>于2016年8月3日

> Well, there I disagree. All of these operations take integers and produce
> other integers. As we've discussed, the bitwise operators resemble
> multiplication or addition in particular ways; not so different at all.
> This is IMO a weak argument because you're arguing gradations of "so
> different", which is entirely subjective in the end.
> What I'm saying is that I would be mildly in favor of your proposal
> because I can justify it on the basis of something black-and-white:
> conflicting "levels" at which these operators work on integers (collection
> of bits vs. element in the set of all integers) and the concomitant
> differences regarding when these operators trap.
> On Tue, Aug 2, 2016 at 16:49 Anton Zhilin <antonyzhilin at gmail.com> wrote:
>> 2016-08-03 0:46 GMT+03:00 Xiaodi Wu <xiaodi.wu at gmail.com>:
>>> It's not that << will overflow and / will not. Substitute * for / and
>>> the argument would be the same. The difference is that << traps when you
>>> shift more than the total number of bits but does *not* trap when you shift
>>> numbers off as would arithmetic exponentiation; * traps on overflow. Thus,
>>> what << is concerned about is the bits (as it should), but * is concerned
>>> about the max representable value.
>> Substitute * for / and my argument would also be the same :)
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160803/3e107723/attachment-0001.html>

More information about the swift-evolution mailing list