OxL Reference

error not-overloadable

error Standard: [§5.3]

What it means#

Overloading with op is possible for arithmetic, bitwise, comparison (through <=>), [], (), as and compound assignment operators. These cannot be overloaded: && || ?? ?. ? ! is = -> ?-> ~> !> |> =>, . and .. (§5.3).

Example#

oxl✓ checked in CI
data Flag { on: bool }

impl Flag {
  static op &&(a: Flag, b: Flag) -> Flag => Flag{ on: a.on }      // <- not-overloadable
}
error
not-overloadable

How to fix#

oxl✓ checked in CI
data Flag { on: bool }

impl Flag {
  fn and(other: Flag) -> Flag => Flag{ on: on }
}

Use an ordinary method, or declare a new operator with the operator keyword and a free symbol.

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides