Skip to content

Commit d46161e

Browse files
committed
Link to section on operator precedence and associativity
1 parent 8ef3116 commit d46161e

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

doc/src/manual/functions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ alone is a matter of coding style.
240240

241241
## Operators Are Functions
242242

243-
In Julia, most operators are just functions with support for special syntax. (The exceptions are
244-
operators with special evaluation semantics like `&&` and `||`. These operators cannot be functions
245-
since [Short-Circuit Evaluation](@ref) requires that their operands are not evaluated before evaluation
246-
of the operator.) Accordingly, you can also apply them using parenthesized argument lists, just
247-
as you would any other function:
243+
In Julia, most [operators](@ref Operator-Precedence-and-Associativity) are just functions with support
244+
for special syntax. (The exceptions are operators with special evaluation semantics like `&&` and `||`.
245+
These operators cannot be functions since [Short-Circuit Evaluation](@ref) requires that their operands
246+
are not evaluated before evaluation of the operator.) Accordingly, you can also apply them using
247+
parenthesized argument lists, just as you would any other function:
248248

249249
```jldoctest
250250
julia> 1 + 2 + 3

doc/src/manual/integers-and-floating-point-numbers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@ julia> 2^2x
683683
64
684684
```
685685

686-
The precedence of numeric literal coefficients is slightly lower than that of
687-
unary operators such as negation.
686+
The [precedence](@ref Operator-Precedence-and-Associativity) of numeric literal
687+
coefficients is slightly lower than that of unary operators such as negation.
688688
So `-2x` is parsed as `(-2) * x` and `√2x` is parsed as `(√2) * x`.
689689
However, numeric literal coefficients parse similarly to unary operators when
690690
combined with exponentiation.

doc/src/manual/variables.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,15 @@ digits (0-9 and other characters in categories Nd/No), as well as other Unicode
108108
and other modifying marks (categories Mn/Mc/Me/Sk), some punctuation connectors (category Pc),
109109
primes, and a few other characters.
110110

111-
Operators like `+` are also valid identifiers, but are parsed specially. In some contexts, operators
112-
can be used just like variables; for example `(+)` refers to the addition function, and `(+) = f`
113-
will reassign it. Most of the Unicode infix operators (in category Sm), such as ``, are parsed
114-
as infix operators and are available for user-defined methods (e.g. you can use `const ⊗ = kron`
115-
to define `` as an infix Kronecker product). Operators can also be suffixed with modifying marks,
116-
primes, and sub/superscripts, e.g. `+̂ₐ″` is parsed as an infix operator with the same precedence as `+`.
117-
A space is required between an operator that ends with a subscript/superscript letter and a subsequent
118-
variable name. For example, if `+ᵃ` is an operator, then `+ᵃx` must be written as `+ᵃ x` to distinguish
119-
it from `+ ᵃx` where `ᵃx` is the variable name.
120-
111+
[Operators](@ref Operator-Precedence-and-Associativity) like `+` are also valid identifiers, but are
112+
parsed specially. In some contexts, operators can be used just like variables; for example `(+)` refers
113+
to the addition function, and `(+) = f` will reassign it. Most of the Unicode infix operators (in
114+
category Sm), such as ``, are parsed as infix operators and are available for user-defined methods
115+
(e.g. you can use `const ⊗ = kron` to define `` as an infix Kronecker product). Operators can also be
116+
suffixed with modifying marks, primes, and sub/superscripts, e.g. `+̂ₐ″` is parsed as an infix operator
117+
with the same precedence as `+`. A space is required between an operator that ends with a
118+
subscript/superscript letter and a subsequent variable name. For example, if `+ᵃ` is an operator, then
119+
`+ᵃx` must be written as `+ᵃ x` to distinguish it from `+ ᵃx` where `ᵃx` is the variable name.
121120

122121
A particular class of variable names is one that contains only underscores. These identifiers are write-only. I.e. they can only be assigned values, which are immediately discarded, and their values cannot be used in any way.
123122

0 commit comments

Comments
 (0)