Docs / Expressions
4. Operators & Precedence
Dryad follows formal precedence rules that group operations from left to right (left associativity), except for local assignments and exponentiations. Implicit conversions include automatic 'number' to 'string' concatenation if one of the operands is a character string.
| Level | Operator | Associativity |
|---|---|---|
| 1 | ., [], (), new | Left-to-right |
| 2 | ++, -- (postfix) | Left-to-right |
| 3 | ++, --, !, -, +, ~ (prefix) | Right-to-left |
| 4 | ** (exponentiation) | Right-to-left |
| 5 | *, /, % | Left-to-right |
| 6 | +, - | Left-to-right |
| 7 | «, », »>, «< | Left-to-right |
| 8 | <, <=, >, >=, in | Left-to-right |
| 9 | ==, != | Left-to-right |
| 10 | & (Bitwise AND) | Left-to-right |
| 15 | =, +=, -=, *=, /= | Right-to-left |
Dryad Coercion Rules
1 let termo = 40 + "2"; // "402" (string concatenation) 2 let flag = true + 5; // 6 (boolean becomes 1 in arithmetic context) 3 let desativada = false * 2; // 0 (false becomes 0) 4 let compara = [] == []; // Arrays and objects are compared by reference
Essential implicit behaviors for lexical type coercion.
Found an error in the spec? Open a PR.
Official Version: 1.0 · May 2026