Define custom operators

You can define operators in a very similar way as groovy's.

Each operator is associated to a function. To define an operator for a given type.

Here is the table of functions to define for each operator

Define operators from extensions

OperatorMethod
a + ba.plus(b)
a - ba.minus(b)
a * ba.multiply(b)
a % ba.mod(b)
a / ba.div(b)
a << ba.leftShift(b)
a >> ba.rightShift(b)
a[b]a.getAt(b)
a?[b]a.getAtSafe(b)
a[b, c, d]a.getAt(b, c, d)
a[b] = ca.putAt(b, c)
a?[b] = ca.putAtSafe(b, c)