At this point, I'm not sure whether this is an -evolution question or a -dev question. The latter would be much easier to work on at this time and could potentially be postponed to a dot release. I know that any conversation not directly related to 3.0 right now is a Bad Thing.
And I suspect that Steven C is probably the right person to know about wrangling precedence and existing standards. -- E > On Sep 5, 2016, at 12:30 AM, Jacob Bandes-Storch <[email protected]> wrote: > > Now you've gotten me thinking about precedence of other operators too. > > Since ?? is prone to causing confusion in either direction (cf. your example > and my example), it could be put in its own group whose relation to the > numeric operators is intentionally undefined (thus requiring parens). > > I don't know about other folks, but I'll certainly get confused if & and | > and ^ are mixed. What if we removed their relation to each other (requiring > parens when mixing them)? > > <proposed-precedence.png> > > For comparison (ha), here's what we have today: > > <current-precedence.png> > > Jacob > > On Sat, Sep 3, 2016 at 10:20 PM, Erica Sadun <[email protected] > <mailto:[email protected]>> wrote: >> On Sep 3, 2016, at 10:15 PM, Jacob Bandes-Storch <[email protected] >> <mailto:[email protected]>> wrote: >> >> Perhaps-conversely, what should this code do? >> >> let nextIndex = foundIndex ?? lastIndex + 1 >> >> Jacob > > It's a good counter example. And there's no optional-associative option. > > -- E > >> >> On Sat, Sep 3, 2016 at 9:05 PM, Erica Sadun via swift-evolution >> <[email protected] <mailto:[email protected]>> wrote: >> Given: `let x = Optional(3)` then >> `let y = 5 + x ?? 2` will not compile >> but >> `let y = 5 + (x ?? 2)` will. >> >> Should NilCoalescingPrecedence be raised? The current operator precedence >> chain is: >> >> BitwiseShiftPrecedence > MultiplicationPrecedence > AdditionPrecedence > >> RangeFormationPrecedence > CastingPrecedence > NilCoalescingPrecedence > >> ComparisonPrecedence > LogicalConjunctionPrecedence > >> LogicalDisjunctionPrecedence > TernaryPrecedence > AssignmentPrecedence > >> FunctionArrowPrecedence > [nothing] >> >> It seems to me that `NilCoalescingPrecedence` should probably be higher than >> `MultiplicationPrecedence` and possibly higher `BitwiseShiftPrecedence` as >> its job is to produce an unwrapped value that can then be operated upon. >> >> I think CastingPrecedence should be even higher because >> `expression as? T ?? fallback value` >> should be parsed as >> `(expression as? T) ?? (fallback value)` >> >> I apologize profusely because I know this is beyond last minute, >> >> -- E >> >> >> _______________________________________________ >> swift-evolution mailing list >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution> >> >> > >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
