[swift-evolution] [Discussion] Breaking precedence

Anton Zhilin antonyzhilin at gmail.com
Tue Aug 2 13:07:23 CDT 2016


2016-08-02 19:08 GMT+03:00 Xiaodi Wu <xiaodi.wu at gmail.com>:

> That's an excellent point, actually. Would there be downsides not yet
> considered?
>
> On Tue, Aug 2, 2016 at 11:03 Félix Cloutier <felixcca at yahoo.ca> wrote:
>
>> These expressions mix two types of logic that have different
>> implications. For instance, `a * 16` and `a << 4` are "mostly equivalent",
>> except that `a * 16` will crash on overflow. In these cases, I find that
>> grouping provides some visual insulation that groups off the somewhat
>> subtle differences.
>>
>> Félix
>>
>
So it at least makes sense to create a proposal about this:

RangeFormation < Addition < Multiplication
RangeFormation < BitwiseOr < BitwiseAnd < BitwiseShift

Pretty much everyone says that moving Ternary below Assignment would be a
regression.
I feel like a bit more discussion is needed on this:

Another concern is NilCoalescing, which can be thought to be semantically
> similar to Ternary. And at the same time it looks like || and &&, which
> would bring it between LogicalConjunction and Comparison.
> Also, do Casting and RangeFormation stand where they should?


Someone said that this is actually not what was planned -- sure, it may
need a separate proposal and a separate thread, but I think it's OK to use
this one for now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160802/ef695e60/attachment.html>


More information about the swift-evolution mailing list