On this page:
operator_  order
operator_  order_  meta.space
operator_  order.def
operator_  order.def_  set
equivalence
order_  comparison
comparison
addition
integer_  division
multiplication
exponentiation
arithmetic
logical_  disjunction
logical_  conjunction
logical_  negation
assignment
enumeration
concatenation
member_  access
pipeline
bitwise_  test
bitwise_  shift
bitwise_  disjunction
bitwise_  conjunction
bitwise_  negation
8.16.0.4

6 Operator Orders🔗

An operator order declares precedence relationships to other operator orders or a default order. An operator defined with a form such as operator or macro can select an operator order using ~order, and then precedence specifications else using the operator order’s name apply to the newly declared operator. The operator also inherits precedence declarations and an associativity declared in its operator order, but an operator declaration can override those.

An operator order is not specific to a space, and operators bound in multple spaces (such as via bind.macro or annot.macro) can use the same set of operator orders.

The space for bindings of identifiers that can be used in operator order positions.

Provided as meta.

A compile-time value that identifies the same space as operator_order. See also SpaceMeta.

definition

operator_order.def id_name:

  option

  ...

 

option

 = 

~stronger_than other ...

 | 

~stronger_than: other ...; ...

 | 

~weaker_than other ...

 | 

~weaker_than: other ...; ...

 | 

~same_as other ...

 | 

~same_as: other ...; ...

 | 

~same_on_left_as other ...

 | 

~same_on_left_as: other ...; ...

 | 

~same_on_right_as other ...

 | 

~same_on_right_as: other ...; ...

 | 

~associativity assoc

 | 

~associativity: assoc

Defines id_name as an operator order with precedence relationships to other operation orders declared by options. Each other in an option must by either ~other or refer to a previously defined operator order; an other cannot be an operator name.

definition

operator_order.def_set id_name:

  order_id_name ...

  ...

Defines id_name as a shorthand for a specification that lists all of the individual order_id_names. The defined id_name can be used in ~stronger, ~weaker, etc., options to declare precedence relationships, but it cannot be used in ~order (i.e., an operator has at more one operator order).

Precedence orders for equality operators == or is_now and ordering comparisons such as < or .=. The comparison shorthand can be used to declare a relationship to both equivalence and order_comparison, and declaring a relationship to order_comparison is rarely useful, but logical_negation refers specifically equivalence.

operator order

operator_order.def addition:

  ~weaker_than:

    integer_division

    multiplication

    exponentiation

  ~stronger_than:

    comparison

 

operator order

operator_order.def integer_division:

  ~weaker_than:

    multiplication

    exponentiation

  ~stronger_than:

    comparison

 

operator order

operator_order.def multiplication:

  ~weaker_than:

    exponentiation

  ~stronger_than:

    comparison

 

operator order

operator_order.def exponentiation:

  ~associativity: ~right

  ~stronger_than:

    comparison

 

operator order set

operator_order.def_set arithmetic:

  addition

  integer_division

  multiplication

  exponentiation

Precedence orders for arithmetic operators such as +, mod, *, and **.

operator order

operator_order.def logical_disjunction:

  ~weaker_than:

    comparison

    concatenation

    enumeration

    arithmetic

    logical_conjunction

    logical_negation

 

operator order

operator_order.def logical_conjunction:

  ~weaker_than:

    comparison

    concatenation

    enumeration

    arithmetic

    logical_negation

 

operator order

operator_order.def logical_negation:

  ~stronger_than:

    equivalence

Precedence orders for operators such as ||, &&, and !.

operator order

operator_order.def assignment:

  ~weaker_than: ~other

Precedence orders for operators such as :=.

operator order

operator_order.def enumeration:

  ~weaker_than: arithmetic

Precedence orders for operators such as ...

operator order

operator_order.def concatenation:

  ~weaker_than:

    comparison

    enumeration

    arithmetic

Precedence orders for operators such as ++ and +&.

operator order

operator_order.def member_access:

  ~stronger_than: ~other

The precedence for an operator such as . or ?..

operator order

operator_order.def pipeline:

  ~weaker_than: ~other

The precedence for an operator such as |> or ?>.

operator order

operator_order.def bitwise_test:

  ~weaker_than:

    comparison

    bitwise_shift

    bitwise_disjunction

    bitwise_conjunction

    bitwise_negation

 

operator order

operator_order.def bitwise_shift:

  ~weaker_than:

    comparison

    bitwise_disjunction

    bitwise_conjunction

    bitwise_negation

 

operator order

operator_order.def bitwise_disjunction:

  ~weaker_than:

    comparison

    bitwise_conjunction

    bitwise_negation

 

operator order

operator_order.def bitwise_conjunction:

  ~weaker_than:

    comparison

    bitwise_negation

 

operator order

operator_order.def bitwise_negation:

  ~weaker_than:

    comparison

Precedence orders for operators such as bits.(?), bits.(<<), bits.or, bits.and, and bits.not.