Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 426 Bytes

File metadata and controls

19 lines (14 loc) · 426 Bytes

Implementation

Operators are implemented with as static methods. They can be prefix, infix, postfix, and static methods. Here are some examples:

class MyOperators {
    // -i
    prefix func -(rhs: int) -> int = ...

    // i++
    postfix func ++(rhs: int^) -> int = ...

    // 2 ** 3
    infix func **(lhs: int, rhs: int) -> int = ...

    // |arr|
    static func |_|(array: [int]) -> int = ...
}