| | @@ -9,7 +9,7 @@ |
| 9 | 9 | This report defines the language. It is short on purpose. Whatever it |
| 10 | 10 | doesn't allow, raz doesn't have. |
| 11 | 11 | |
| 12 | | -This is version 2026-10.13 of the report; section 12 says what each |
| 12 | +This is version 2026-10.14 of the report; section 12 says what each |
| 13 | 13 | version changed. 2026-10.11 and 2026-10.12 are a thaw the owner chose, |
| 14 | 14 | for a language anyone can build again. They break programs written |
| 15 | 15 | for 2026-10.10 and before: for 2026-10.9, say, the report of compiler |
| | @@ -51,7 +51,8 @@ |
| 51 | 51 | |
| 52 | 52 | **Identifiers** are an ASCII letter or `_` followed by letters, digits |
| 53 | 53 | and `_`, up to 63 characters. Case matters: `count` and `Count` are different |
| 54 | | -names. |
| 54 | +names. `_` alone isn't a name: it is the blank, which stands only to |
| 55 | +the left of `:=` (section 7.1). |
| 55 | 56 | |
| 56 | 57 | **Reserved words** are lowercase, except `VOLATILE`: |
| 57 | 58 | |
| | @@ -795,7 +796,8 @@ |
| 795 | 796 | ``` |
| 796 | 797 | Statements = { Statement ";" } . |
| 797 | 798 | Statement = Designator [ ":=" Expr ] |
| 798 | | - | Designator "," Designator { "," Designator } ":=" Expr |
| 799 | + | "_" ":=" Expr |
| 800 | + | Target "," Target { "," Target } ":=" Expr |
| 799 | 801 | | "if" Expr "then" Statements |
| 800 | 802 | { "elsif" Expr "then" Statements } [ "else" Statements ] "end" |
| 801 | 803 | | "while" Expr "do" Statements "end" |
| | @@ -808,6 +810,7 @@ |
| 808 | 810 | Arm = ( ident [ "(" ident { "," ident } ")" ] |
| 809 | 811 | | Label { "," Label } | "else" ) ":" Statements . |
| 810 | 812 | Label = Expr [ ".." Expr ] . |
| 813 | +Target = Designator | "_" . |
| 811 | 814 | ``` |
| 812 | 815 | |
| 813 | 816 | Every statement ends in `;`, including the ones that end in `end` or |
| | @@ -822,6 +825,13 @@ |
| 822 | 825 | `a, b := f(x);` assigns the results of a procedure that returns several |
| 823 | 826 | (section 8), in order. |
| 824 | 827 | |
| 828 | +The blank, `_`, drops what would be assigned to it: `_ := e;` |
| 829 | +evaluates `e` and drops it, and `n, _ := f(x);` keeps the first |
| 830 | +result and drops the second. What is dropped is still evaluated as |
| 831 | +any expression is: its calls are made, and a volatile variable in it |
| 832 | +is read (section 7.6). A result dropped by a call standing on its own |
| 833 | +is warned of (section 10); one dropped through `_` isn't. |
| 834 | + |
| 825 | 835 | ### 7.2 Conditions and loops |
| 826 | 836 | |
| 827 | 837 | `if`, `while` and `repeat` take `BOOL` expressions. `repeat` runs its |
| | @@ -1181,9 +1191,10 @@ |
| 1181 | 1191 | The compiler also warns of what is declared and never used: an import; |
| 1182 | 1192 | a constant, type, variable or procedure that isn't exported; a |
| 1183 | 1193 | parameter of a procedure written in raz. It warns of a variable that is |
| 1184 | | -assigned but never read, too. A name that starts with `_` is never |
| 1185 | | -warned about. Warnings don't stop the compile; `raz -Werror` makes them |
| 1186 | | -errors. |
| 1194 | +assigned but never read, too, and of a call standing on its own that |
| 1195 | +drops a result, as `Sys.write(fd, s);` does: `_ := Sys.write(fd, s);` |
| 1196 | +says it is meant. A name that starts with `_` is never warned about. |
| 1197 | +Warnings don't stop the compile; `raz -Werror` makes them errors. |
| 1187 | 1198 | |
| 1188 | 1199 | ## 11. The library |
| 1189 | 1200 | |
| | @@ -1879,6 +1890,9 @@ |
| 1879 | 1890 | them on demand (sections 10 and 11). |
| 1880 | 1891 | - **2026-10.13.** `Sys` gains writing without waiting, and waiting for |
| 1881 | 1892 | room to write (section 11). |
| 1893 | +- **2026-10.14.** The blank, `_`, drops a value or one of several |
| 1894 | + results (section 7.1); a call that drops a result is warned of |
| 1895 | + (section 10). |
| 1882 | 1896 | |
| 1883 | 1897 | ## Appendix A. What an implementation chooses |
| 1884 | 1898 | |
| | @@ -2011,7 +2025,8 @@ |
| 2011 | 2025 | |
| 2012 | 2026 | Statements = { Statement ";" } . |
| 2013 | 2027 | Statement = Designator [ ":=" Expr ] |
| 2014 | | - | Designator "," Designator { "," Designator } ":=" Expr |
| 2028 | + | "_" ":=" Expr |
| 2029 | + | Target "," Target { "," Target } ":=" Expr |
| 2015 | 2030 | | "if" Expr "then" Statements |
| 2016 | 2031 | { "elsif" Expr "then" Statements } [ "else" Statements ] "end" |
| 2017 | 2032 | | "while" Expr "do" Statements "end" |
| | @@ -2024,6 +2039,7 @@ |
| 2024 | 2039 | Arm = ( ident [ "(" ident { "," ident } ")" ] |
| 2025 | 2040 | | Label { "," Label } | "else" ) ":" Statements . |
| 2026 | 2041 | Label = Expr [ ".." Expr ] . |
| 2042 | +Target = Designator | "_" . |
| 2027 | 2043 | |
| 2028 | 2044 | ProcDeclaration = "proc" IdentDef Signature ";" |
| 2029 | 2045 | ( "forward" | { LocalDeclaration } "begin" Statements "end" [ ident ] |