Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes:

    precedencegroup MyPrecedence {}
    infix operator +++: MyPrecedence
    func +++ (lhs: Int, rhs: Int) -> Int { lhs + rhs }
    let a = 1 + 2 +++ 3
Error:

    Adjacent operators are in unordered precedence groups 'AdditionPrecedence' and 'MyPrecedence'


Very cool, thanks a lot for the example!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: